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

Uncaught Error: Unexpected object passed to ReactTestInstance constructor (tag: 13). This is probably a bug in React. #12498

Closed
pedroteixeira opened this issue Mar 30, 2018 · 9 comments

Comments

@pedroteixeira
Copy link

pedroteixeira commented Mar 30, 2018

Hello,

I'm testing v16.3.0 and I'm getting this warning:

Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported 

My use case is that I wanted to render React Test Renderer (for ex) from a Component in an another (ReactDOM) renderer but it does not seem to work - I wanted to use same Provider in both containers.

I thought React.createContext create objects with no state and could be shared across renderers / Fiber containers.. Is there workaround for this? Are there any thoughts on this, Is this a definite behaviour?

Following the warning, I eventually get the error message which I believe is related to the warning:

Uncaught Error: Unexpected object passed to ReactTestInstance constructor (tag: 13). This is probably a bug in React.

thank you for any guidance :)

@pedroteixeira pedroteixeira changed the title Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported Uncaught Error: Unexpected object passed to ReactTestInstance constructor (tag: 13). This is probably a bug in React. Mar 30, 2018
@gaearon
Copy link
Collaborator

gaearon commented Apr 1, 2018

@acdlite What was the main reason it was stateful?

@pedroteixeira
Copy link
Author

pedroteixeira commented Apr 3, 2018

I tried to make a reproducible case here, but it worked :)
https://runkit.com/pedroteixeira/testing-react/1.0.0

I'll close this issue for now, and when I managed to create a reproducible snippet fort the case I have, I'll share it again.

But it would be good to hear more about if the new Contexts Providers can be safely used without any hidden state attached to the current fiber container.

thanks for the great library!

@sahrens
Copy link
Contributor

sahrens commented Jun 10, 2018

I'm seeing this error when switching to React.forwardRef - I'm guessing react-test-renderer may need to be updated to support forwardRef better?

@sahrens
Copy link
Contributor

sahrens commented Jun 10, 2018

Ah, just saw #12693, maybe this is resolved by #12725?

@gaearon
Copy link
Collaborator

gaearon commented Jun 10, 2018

@sahrens You're sure you're using 16.4.0? If you can create a small repro case that would help.

@sahrens
Copy link
Contributor

sahrens commented Jun 10, 2018

@gaearon: works after upgrading to 16.4 :)

@sahrens
Copy link
Contributor

sahrens commented Jun 11, 2018

Although React.StrictMode and React.Fragment cause similar problems, but are easy to work around by wrapping in a trivial component.

@gaearon
Copy link
Collaborator

gaearon commented Jun 11, 2018

Can you prepare a test case please? Again, I wouldn’t expect to see this problem for any type. You shouldn’t need to work around it; I thought I fixed it. A full reproducing case would help me see what’s missing.

@stereobooster
Copy link

For future searchers. I see this error with enzyme https://github.com/stereobooster/react-context-issue (I guess this is not an issue in React itself)

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

4 participants