-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Strange beahvior React + new Context API #12686
Labels
Comments
Thanks for the report—any chance you could condense your findings into a small isolated example with a brief description? This is a lot to sift through. |
@gaearon, I did it. Description of Issue and video were updated. Example is very simple and small app at present. |
This is a bug. |
#12708 should fix this. |
@axules Thanks for a great reproducing case, it was extremely helpful |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think it is a bug.
Git with example - https://github.com/axules/react-context-research
Dependencies
React v16.3.2
Chrome v65.0.3325.181
Components
Context - OrderDetailsContext
Root component - OrdersView
Simple component - OrdersViewRow
Subscribed component - OrderDetailsView
Problem
Application have one dynamic context (OrderDetailsContext) and 3 components: one root component (OrdersView) and 2 children components (OrdersViewRow and OrderDetailsView). Only one component (OrderDetailsView) subscribed to dynamic context and have to be refreshed once context data is changed. But with them we have problem.
When context is changed the subscribed component is not refreshed and have old version of context data.
actual
OrderDetailsView do not update once context is updated.
expected
OrderDetailsView will update once context is updated.
First solution
Go to OrdersView and move OrderDetailsView to the top of render function, then subscribed component will be updated when context is changed.
![image](https://user-images.githubusercontent.com/20991327/39345798-42d1dd14-49f3-11e8-8d45-ac29bd50204f.png)
Second strange solution
Go to separeted component (OrdersViewRow) and just remove
<td>Remove this td and I will work!</td>
, then subscribed component will be updated when context is changed.Video
https://youtu.be/WET0a2hApwM
Reproduce
expected
actual
The text was updated successfully, but these errors were encountered: