facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
229.09k stars 46.87k forks source link

debugID may not be empty. #9698

Closed gdborton closed 7 years ago

gdborton commented 7 years ago

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

What is the current behavior? Our tests are sporadically logging a warning Warning: ReactDebugTool: debugID may not be empty.. We fail any tests that log warnings, so this is causing flakiness.

If the current behavior is a bug, please provide the steps to reproduce... I'm unable to consistently reproduce, but we're seeing roughly a 2% failure rate for our test suite. Doesn't seem to be any patterns around which tests will fail with this error.

What is the expected behavior? I'd expect our tests to either log a warning consistently if we're doing something wrong or to not log a warning at all.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

❯ node --version; npm --version; npm ls react react-dom enzyme
v6.10.2
2.15.12
Airbnb@1.0.0 /Users/gary_borton/airlab/repos/airbnb
├── enzyme@2.8.0 
├── react@15.4.2 
├── react-dom@15.4.2 
└─┬ react-router-dom@4.1.1
  └── react@15.5.4 

The appearance of this warning correlates pretty closely with our migration from node 4 to node 6.

gdborton commented 7 years ago

I've seen this come up using both mount and render from enzyme, and after investigating briefly I see that render is just proxying to require('react-dom/server').renderToStaticMarkup so I think enzyme can be ruled out as the cause.

gdborton commented 7 years ago

Seeing another issue with React logging warning messages in our tests...

Warning: Exception thrown by hook while handling onSetChildren: Invariant Violation: Expected hook events to fire for the child before its parent includes it in onSetChildren()
vste23 commented 7 years ago

Having the same issue. My test log is full of this warnings. Any ideas how to fix this? ERROR: 'Warning: ReactDebugTool: debugID may not be empty.'

gaearon commented 7 years ago

It is hard to fix this without a reproducing project.

gdborton commented 7 years ago

For sure... we (Airbnb) are seeing it happen in only ~1% of test runs on 4,400+ test files with no apparent pattern. I'll try to recreate as best I can, but I'm not sure I'll be able to come up with a consistent failure.

vste23 commented 7 years ago

I will create reproducing project tomorrow. In my case it giving this error for every test I have in my project

gaearon commented 7 years ago

This doesn't look good:

2.15.12
Airbnb@1.0.0 /Users/gary_borton/airlab/repos/airbnb
├── enzyme@2.8.0 
├── react@15.4.2  <--------------- react
├── react-dom@15.4.2 
└─┬ react-router-dom@4.1.1
  └── react@15.5.4  <------------------ another react!

Having two Reacts causes all sorts of issues. Can you please ensure you only have one copy, and try again?

ljharb commented 7 years ago

Thanks - we'll dedupe those properly and see if it helps :-)

gaearon commented 7 years ago

I'll close because it seems like a corner case caused by duplicate packages, and this code doesn't exist in React 16 anyway.

ljharb commented 7 years ago

Thanks; sorry I didn't follow up. Deduping the Reacts seems to have fixed it.