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.

Unhelpful Re-render (Glimmer?) error message: `Failed to execute 'insertBefore' on 'Node'`

See original GitHub issue

I’m polling for server changes using ember-concurrency. When new data arrives, I’m seeing Error: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node. and the view isn’t re-rendered.

Not 100% certain that this is an ember bug, rather than me doing something silly, but given that the initial render works fine, and this only occurs when new data is added, this seems like it might be a problem with Glimmer’s DOM diffing (and, if this is expected behavior, a more helpful error message would certainly be appreciated 😃

Full traceback:

ember.debug.js:18008 Error: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
    at Error (native)
    at DOMChanges.insertBefore (http://localhost:4200/assets/vendor.js:66816:21)
    at DOMChanges.insertAfter (http://localhost:4200/assets/vendor.js:66820:18)
    at ListBlockOpcode.evaluate (http://localhost:4200/assets/vendor.js:70691:21)
    at UpdatingVM.execute (http://localhost:4200/assets/vendor.js:70446:24)
    at RenderResult.rerender (http://localhost:4200/assets/vendor.js:70385:16)
    at RootState._this.render (http://localhost:4200/assets/vendor.js:27867:18)
    at runInTransaction (http://localhost:4200/assets/vendor.js:39184:28)
    at InteractiveRenderer._renderRoots (http://localhost:4200/assets/vendor.js:28128:48)
    at InteractiveRenderer._renderRootsTransaction (http://localhost:4200/assets/vendor.js:28166:14)

defaultDispatch @ ember.debug.js:18008
dispatchError @ ember.debug.js:17987
invokeWithOnError @ ember.debug.js:349
flush @ ember.debug.js:405
flush @ ember.debug.js:529
end @ ember.debug.js:599
(anonymous function) @ ember.debug.js:1165

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gabrielgrantcommented, Mar 28, 2017

It was suggested in slack that this is likely being caused by my use of a JS tool that modifies the DOM directly, which seems likely to be a not-entirely-uncommon mistake. Having an error message that suggested possible causes of this failure would be helpful.

In the case of this particular lib, I’m able to work around the issue by manually supplying a wrapper element, so it doesn’t create it’s own internally. It’s not clear how I’d work around this in the general jquery plugin case, though. It might be worth updating the didInsertElement/didRender docs to explain what can/cannot be done in each hook, along with the proper work-around (if one exists). Right now the docs for didRender say “You can leverage [the didRender] hook to perform post-processing on the DOM of a component after its been updated”, which seems to me to imply that what I was doing should work

0reactions
pixelhandlercommented, Oct 26, 2018

Closing for now (this is inactive) feel free to re-open if still needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redux throwing error saying Failed to execute 'insertBefore ...
I am working on my react application and getting this error. Failed to execute 'insertBefore' on 'Node': The node before which the new...
Read more >
Tagless component challenge after Glimmer update - Ember.JS
When the component eventually rerenders after an update, It fails with a similar error: DOMException: Failed to execute 'insertBefore' on 'Node ...
Read more >
254144 - Iframe reloads when moved around the DOM tree.
This incorrect behavior can be observed any time an iframe node is pulled from the DOM tree and re-inserted, whether it is done...
Read more >
Failed to execute 'insertBefore' on 'Node' error crashes ...
The below error is generated when start editing in gutenberg and it crashes. Error: Failed to execute 'insertBefore' on 'Node': The node before...
Read more >
zxcvbn-async.js - Drupal
parentNode.insertBefore(b,a)};null!=window. ... mum,motion,fella,enemies,desert,collection,incident,failure,satisfied,imagination,hooked,headache,forgetting ...
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