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

RootElement not updated with new props on listen #884

Open
salehhamadeh opened this issue Feb 23, 2017 · 3 comments
Open

RootElement not updated with new props on listen #884

salehhamadeh opened this issue Feb 23, 2017 · 3 comments
Labels
bug An issue with the system

Comments

@salehhamadeh
Copy link
Contributor

I am trying to re-render a page after a change is emitted to listen. RootElement is getting the changes from the emitter, and the callback in componentDidMount is called with the correct childProps. this.props is set to use the new childProps correctly when we set it using _.assign. However, once we call this.forceUpdate(), the props are reset to what they were before the change. Since this happens with every update, the page is not responsive on the client-side. Here is the code for reference.

this.props.subscribe(childProps => {
        ...
        // Okay, now we've complained about it
        // sufficiently, let's go ahead and update.
        this.props = _.assign({}, this.props, {childProps});
        this.forceUpdate();
});

I am using React 15.4.1

@gigabo
Copy link
Contributor

gigabo commented Feb 23, 2017

Thanks for reporting @salehhamadeh.

I wonder if this broke with the React 15 upgrade... 🤔

Any idea what we could do here to get it working?

@gigabo gigabo added the bug An issue with the system label Feb 23, 2017
@salehhamadeh
Copy link
Contributor Author

Can we use setState instead of updating the props and forcing an update?

@gigabo
Copy link
Contributor

gigabo commented Feb 23, 2017

React Server RootElements set props on first render. Seems weird to change that to state later?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with the system
Projects
None yet
Development

No branches or pull requests

2 participants