Skip to content

issue with connect, outdated props when rendered #43

@CosticaPuntaru

Description

@CosticaPuntaru

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions