-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Breaking change in v7 - componentDidUpdate order #1432
Comments
We aren't using Now, we are using React-Redux has never explicitly guaranteed the kind of behavior you're describing - that falls under the heading of implementation details, and isn't part of our public API. |
Hi mark, thanks for the quick answer! Is there a way to know once all changes have been processed and components re-rendered following an action being dispatched? |
Unfortunately, not that I know of. I wish there was - it would be helpful for some of our benchmarking efforts. |
I guess we have no other choice but to try remove our dependency on this behavior going forward, though I'm really surprised by this. Thanks for the help regardless! |
Yeah, it's amazing how many subtle aspects of behavior people rely on and assume that it's "correct", even though it's actually implementation-specific. For example, in v6 we switched to passing store state via context for consistency, only to find out that people were relying on the immediate changes being reflected in child components in earlier versions when mounting code-split reducers via lazy-loaded components. |
Actually, looking at the lifecycle trace, I think the other issue may specifically be with v6 versus other versions. In v5 and v7, we implement our own store update cascading logic in order to enforce top-down updates. Connected ancestors notify nested connected descendants after the ancestors have finished rendering. This does actually mean that parent components are likely happening in a separate render cycle from the descendants. In v6, everything was done via React's normal top-down rendering pass. Thinking about it, that does likely mean that a parent will have completely rendered and be done, before a nested connected component renders. |
The root cause of this error is wrapping the For now, as a workaround, pass |
@ckedar : no, that's not correct, and I don't know why you're saying that.
The |
We are running into some difficulty updating to v7 due to what seems like a breaking change.
Context: We're rendering react inside a larger non-react webapp, where when user does some action, some hidden forms get rendered and the form submit.
We detect if it's time to submit by using
componentDidUpdate
method on a parent component - relying that child forms have re-rendered by the time componentDidUpdate has been called.With v7 this seems to be broken - componentDidUpdate for parent is called before child render.
Repro: https://codesandbox.io/embed/eloquent-bas-b12b6
V7 order:
V6 order:
This seems like a bug to us as official docs state
Is the order in v7 intentional?
The text was updated successfully, but these errors were encountered: