-
Notifications
You must be signed in to change notification settings - Fork 138
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
run action while componentDidMount do not trigger props update #169
Labels
Comments
Is this in React, or Preact? It seems like a bug, due to the reversed execution order for https://github.com/developit/unistore/blob/master/src/integrations/react.js#L46 One possible solution would be to use a different heuristic for differentiating between SSR and client-side rendering. |
tumerorkun
pushed a commit
to tumerorkun/unistore
that referenced
this issue
Mar 10, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this example shows what i had done.
i triggered an action in componentDidMount, but componentWillReceiveProps can not receive any update.
i look into the code and found out the problem is the wrapper outside my component register a listener while componentDidMount, but its child componet, my component, mounted before the wrapper.
so when my component run componentDidMount, the wrapper haven't run the subscription method yet. therefore it can't reveive any update.
so why not use the componentWillMount to replace the componentDidMount. componentWillMount will be triggered in a right order from parent to child. so subscription function can capture and update any changes from the child component.
The text was updated successfully, but these errors were encountered: