Description
React version: 18.0.0-beta-149b420f6-20211119
Steps To Reproduce
- render a context with
react-test-renderer
(wrapped in act) - render the same context with
react-dom/server
Link to code example: https://codesandbox.io/s/react-18-react-test-renderer-react-dom-server-forked-lbs7j?file=/package.json:189-219
const Context = React.createContext(null);
function Component({ renderer }) {
return (
<Context.Provider value={renderer}>
<div />
</Context.Provider>
);
}
let testRendererRoot;
ReactTestRenderer.act(() => {
testRendererRoot = ReactTestRenderer.create(
<Component renderer="react-test-renderer" />
);
});
ReactTestRenderer.act(() => {
testRendererRoot.unmount();
});
ReactDOMServer.renderToString(<Component renderer="react-dom/server" />);
The current behavior
renderToString
results in the console error "Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."
The expected behavior
No error like in React 17 (https://codesandbox.io/s/react-17-react-test-renderer-react-dom-server-yr8gx).
Considering all renders are wrapped in their corresponding act
I don't expect that I'm concurrently rendering.
I tried to understand when we reset the rendererSigil
(responsible for checking if we "concurrently rendering") is reset and it seems like we never reset it but only initialize it when creating the context (createContext
)
So it either seems like multiple renderers in the same module are not supported anymore or the reset is missing.