Skip to content
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

issue with connect, outdated props when rendered #43

Open
CosticaPuntaru opened this issue Oct 22, 2018 · 1 comment
Open

issue with connect, outdated props when rendered #43

CosticaPuntaru opened this issue Oct 22, 2018 · 1 comment

Comments

@CosticaPuntaru
Copy link

here is a repo to reproduce the issue but i will try to summarise it here
https://github.com/CosticaPuntaru/react-walk-tree--redux-bug

tl:dr;
in order for nested component to render properly the component instance needs to recalculate props after the "visitor" function is run and before render is called.

what i understand from what happens:
case: we have two components that want to lazy load data from server, one sibling of the other
(i call them first and second), both of them are decorated with redux connect

running steps:
reactWalkTree gets the App and walks it
runs the connector component, binds the store props to the component props,
then runs by "bootstrap" function,
waits for it to finish and then runs the render,

the issue is that the render function is called with the props that were bind to the component before the "bootstrap" function was called. and having a if(!ready) return (<div>Loading</div>); will never give a change to the secondComponent.bootstrap to run and gather the data. thus not not getting the correct ssr,

hope this is clear enough,

@oyeanuj
Copy link

oyeanuj commented Dec 23, 2018

FWIW, I'm seeing the same issue with parent & child components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants