Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute 'insertBefore' on 'Node' #13278

Closed
vbrvk opened this issue Jul 27, 2018 · 13 comments
Closed

Failed to execute 'insertBefore' on 'Node' #13278

vbrvk opened this issue Jul 27, 2018 · 13 comments

Comments

@vbrvk
Copy link

vbrvk commented Jul 27, 2018

Do you want to request a feature or report a bug?
BUG

I am not shure if it is react bug, or my code, or anything else, but i got next error message from client logs. I don't use any other library to manipulate DOM. Unfortunatly I can't figure out which part of my code throw this

Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.

../node_modules/react-dom/cjs/react-dom.production.min.js (at c.child.return=c,c=c.child}if(!) 190:258)
in ../node_modules/react-dom/cjs/react-dom.production.min.js (at 4:break;default:A("163")}}U=U.nextEffect}}catch(Wa){f=!0,g=Wa}f&&(null===U?A) 215:424)
in ../node_modules/react-dom/cjs/react-dom.production.min.js (at Vh) 211:213)
in ../node_modules/react-dom/cjs/react-dom.production.min.js (at Qh) 210:276)
in ../node_modules/react-dom/cjs/react-dom.production.min.js (at Qh) 210:112)
in ../node_modules/react-dom/cjs/react-dom.production.min.js (at wh) 208:243)
in ../node_modules/react-dom/cjs/react-dom.production.min.js (at kg) 206:315)
in ../node_modules/react-dom/cjs/react-dom.production.min.js (at isMounted) 147:224)
in ../node_modules/react/cjs/react.production.min.js (at isMounted) 12:343)
in ../node_modules/react-redux/es/components/connectAdvanced.js (at this.selector.run) 205:0)

Will appreciate any advices about possible sollution

Versions:
react: 16.4.0, react-dom: 16.4.0

@gaearon
Copy link
Collaborator

gaearon commented Jul 27, 2018

We'll need a reproducing example for this.

@gaearon
Copy link
Collaborator

gaearon commented Aug 2, 2018

Going to close since we can't help without a reproducing case. If you find one please file a new issue. Thanks!

@gaearon gaearon closed this as completed Aug 2, 2018
@vbrvk
Copy link
Author

vbrvk commented Aug 7, 2018

I still can't reproduce it, but I have figure out which code throw an error (if I can trust the react componentDidCatch info).
I use styled-components and have next code:

export const Desc = styled.span`
  max-width: 40%;
  margin-right: 5px;
  font-size: .9rem;
  text-align: left;
`;


// later this component renders as

<Desc>{symbol}/ETH</Desc>

In Chrome DevTools this component looks like:
image

There are two textNode and I assume that problems is hiding here, but again, I can't reproduce it on any machine which I have.

I know that errors happend in next environment:

{
  "browser": { "name": "Chrome", "version": "63.0.3239.26" },
  "os": { "name": "Windows", "version": "NT 10.0", "versionName": "10" },
  "platform": { "type": "desktop" },
  "engine": { "name": "Blink" }
}

{
  "browser": { "name": "Chrome", "version": "68.0.3440.84" },
  "os": { "name": "Windows", "version": "NT 6.1", "versionName": "7" },
  "platform": { "type": "desktop" },
  "engine": { "name": "Blink" }
}

If you have any idea how can I try to reproduce the bug, please let me know. Thanks!

@gaearon
Copy link
Collaborator

gaearon commented Aug 7, 2018

My guess is that it's either #11538 or equivalent.

@vbrvk
Copy link
Author

vbrvk commented Aug 7, 2018

Seems you are right. Thanks you a lot!

@DaGhostman
Copy link

DaGhostman commented Jun 25, 2019

Think we've observed the same issue on our end it seems to be related to automated translation from google translate:

Uncaught DOMException: 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 yi (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:76637)
    at Fi (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:81449)
    at Vi (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:84893)
    at https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:98269
    at Object.t.unstable_runWithPriority (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:94:3194)
    at Tc (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:98204)
    at jc (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:97980)
    at xc (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:97325)
    at Dc (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:98700)
    at kn (https://assets.mailjet.com/build/app-components-04376153a9aaffa109ce.js:85:30568)

Should I attempt to provide a minimal sample that reproduces the problem

Browser: Version 75.0.3770.100 (Official Build) (64-bit)
OS: Ubuntu 19.04

@mjhoffm2
Copy link

I am running into this problem using react 16.8.6, what version will this be fixed for?

@rsshilli
Copy link

@mjhoffm2 I'm not convinced there's anything to fix in React. I got this error too and it turned out that it was my fault: https://stackoverflow.com/a/59845764/491553

@vincentaudebert
Copy link

vincentaudebert commented Sep 28, 2020

FYI if it can help someone else, I had the same issue and turned out <br />s in my "dynamic" text were randomly causing the issue with Google Translate.

Solution was to replace <br /> with proper tags and now it works fine.

@j-perl
Copy link

j-perl commented Feb 21, 2022

I ended up here by chance and by turning Google Translate on, I could reproduce the issue our client was having. Thank you @vincentaudebert!

@hch-web
Copy link

hch-web commented Mar 11, 2024

@j-perl Thanks for helping us out. It really worked.

@prhbrt
Copy link

prhbrt commented Oct 10, 2024

For other struggling with Failed to execute 'insertBefore' on 'Node'. I had a similar issue, and couldn't fix it:

{loading ? <Box className="loading-bar"><Typography><CircularProgress className="line-center m-left20" /> Loading annotations</Typography></Box> : undefined}

And used this alternative (which is not equivalent):

<Box className={`loading-bar ${loading ? "" : "hidden "}`}><Typography><CircularProgress className="line-center m-left20" /> Loading annotations</Typography></Box>

@SpeedyM282
Copy link

@j-perl bro thanks a lot for help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants