You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In version react-dom@16.6.1 I used Context.Consumer in renderToStaticMarkup and it works fine if a call it, but in react-dom@16.6.3 Context.Consumer lose Context.Provider. To be precise Consumer loses only new values passed to Provider, default values work fine in all cases.
Context.Consumer don't lose a context passed with Context.Provider.
Maybe the example is wrong and there is another way to render Context.Consumer's components into a string?
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
In react-dom@16.6.1 - works fine
In react-dom@16.6.3 - context losed
The text was updated successfully, but these errors were encountered:
Context shouldn't propagate through renderToStaticMarkup / renderToString calls. Unfortunately that was a bug in the original release which got fixed in 16.6.3. While I understand in your case you might have expected it to work, but it's just as likely that it could cause product bugs (in case you're rendering <Something /> that's meant to be isolated and it picks up the wrong context from above).
The use case itself is interesting and potentially legit. I'll create a separate issue to track it.
Do you want to request a feature or report a bug?
bug or unexpected behavior
What is the current behavior?
In version react-dom@16.6.1 I used Context.Consumer in renderToStaticMarkup and it works fine if a call it, but in react-dom@16.6.3 Context.Consumer lose Context.Provider. To be precise Consumer loses only new values passed to Provider, default values work fine in all cases.
Example below:
with react-dom@16.6.1 - https://codesandbox.io/s/0movl04pyw
with react-dom@16.6.3 - https://codesandbox.io/s/6j39m60j9n
What is the expected behavior?
Context.Consumer don't lose a context passed with Context.Provider.
Maybe the example is wrong and there is another way to render Context.Consumer's components into a string?
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
In react-dom@16.6.1 - works fine
In react-dom@16.6.3 - context losed
The text was updated successfully, but these errors were encountered: