question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checking node with not-yet-loaded children causes an exception

See original GitHub issue

Hi there,

I’m having some issues combining lazy loading with checkboxes. Checking a node with hasChildren: true when the children are not loaded yet causes an exception. See plunkr: https://plnkr.co/edit/wigPSzzk3R0XM9RE173D?p=preview

Steps to reproduce:

  1. Check Root2

SecondChild has one async loaded child and is not checked after expanding. After all the async children are loaded the issue disappears.

Is there a way to work around this or is this a bug?

Stack trace from plunkr:

ERROR TypeError: Cannot read property 'forEach' of undefined
    at e.setIsSelected (VM630 angular-tree-component@7.0.1:1)
    at eval (VM630 angular-tree-component@7.0.1:1)
    at Array.forEach (<anonymous>)
    at ObservableArray.eval (VM672 mobx@^3:697)
    at e.setIsSelected (VM630 angular-tree-component@7.0.1:1)
    at e.toggleSelected (VM630 angular-tree-component@7.0.1:1)
    at TOGGLE_SELECTED (VM630 angular-tree-component@7.0.1:1)
    at e.mouseAction (VM630 angular-tree-component@7.0.1:1)
    at Object.eval [as handleEvent] (VM674 e.ngfactory.js:13)
    at handleEvent (VM627 core.umd.js:13620)

Thanks for the work on the tree component and looking forward to hearing from you.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

3reactions
ghostcommented, Jan 9, 2018

Here is a fix that I have issued in a local branch. I attempted to push this up to the repo in a new branch but access was denied

In tree-node.model.ts / setIsSelected

  setIsSelected(value) {
    if (this.isLeaf || !this.children) {
      this.treeModel.setSelectedNode(this, value);
    } else {
      this.children.forEach((child) => child.setIsSelected(value));
    }

    return this;
  }
0reactions
ghostcommented, Feb 1, 2018

I could not create a new branch and push I was unauthorised and therefor could not create a pull request

Read more comments on GitHub >

github_iconTop Results From Across the Web

Checking node with not-yet-loaded children causes ... - GitHub
Hi there, I'm having some issues combining lazy loading with checkboxes. Checking a node with hasChildren: true when the children are not ...
Read more >
Process | Node.js v19.3.0 Documentation
Attempting to resume application code without properly recovering from the exception can cause additional unforeseen and unpredictable issues. Exceptions thrown ...
Read more >
Node.childNodes - Web APIs - MDN Web Docs
The read-only childNodes property of the Node interface returns a live NodeList of child nodes of the given element where the first child...
Read more >
process
The 'uncaughtException' event is emitted when an exception bubbles all the way back to the event loop. By default, Node.js handles such exceptions...
Read more >
tables.group — PyTables 3.8.0 documentation
Any attempt to create a new child node whose name starts with one of these prefixes will raise a ValueError exception. Another effect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found