Enzyme + Context API = Warning: Detected multiple renderers concurrently rendering the same context provider

See original GitHub issue

Do you want to request a feature or report a bug? Bug, I guess

What is the current behavior?

  console.error node_modules/fbjs/lib/warning.js:33
    Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.

Steps to reproduce the behavior:

  1. git clone https://github.com/stereobooster/react-context-issue
  2. cd react-context-issue
  3. yarn
  4. yarn test

What is the expected behavior? no warning

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? React 16.4. Browser not affected, because error is in node.js

Open this because of https://github.com/facebook/react/pull/13127#issuecomment-402527012

Issue happens because of Enzyme (https://github.com/airbnb/enzyme/issues/1693), code is unreleased, so I copy-pasted it from master.

I’m looking for advice or some clue on how to fix this, so I would be able to create PR in Enzyme repo (or in React repo if this is the case). Thank you.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:21 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
gaearoncommented, Jul 6, 2018

I wouldn’t call this a “solution”, this is just ignoring the problem (and working around it). Maybe you don’t need it fixed, but somebody else will. 😃

It’s fine if you don’t want to keep looking into this, but it does sound like a bug to me. And we should fix it.

2reactions
shanshanzhucommented, Oct 19, 2018

We are at React16.5.2, but we still see this error when putting the tests using mount and enzyme-to-json in one test file. Error is gone when tests are separated into two files.

  console.error node_modules/react-dom/cjs/react-dom.development.js:509
    Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Richard Lindsey on Twitter: "@dan_abramov -- "Detected ...
-- "Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported." Is this a side-effect of having nested ...
Read more >
ReactDOM.render is no longer supported in React 18 - Stack ...
ReactDOM.render has been deprecated in React 18 and currently issues a warning and ... Using it will warn and run your app in...
Read more >
React Components rendered twice — any way to fix this?
Detecting legacy context API. In most cases it will throw an error message into the browser console log. It fails to automatically detect...
Read more >
Legacy Context - React
This section documents a legacy API. See the new API. Suppose you have a structure like: class Button extends React.Component { render() {...
Read more >
react-test-renderer | Yarn - Package Manager
The deferred render is interruptible and doesn't block user input. useSyncExternalStore is a new hook that allows external stores to support concurrent reads...
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