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

<Link /> not rerendering after a route change #3522

Closed
yormi opened this issue Jun 8, 2016 · 3 comments
Closed

<Link /> not rerendering after a route change #3522

yormi opened this issue Jun 8, 2016 · 3 comments

Comments

@yormi
Copy link

yormi commented Jun 8, 2016

Version

2.4.0

I have a project with a lot around react-router (react-router-redux among other things) so I'm still trying to isolate the problem but I'm posting the issue in the meantime if someone is having the same problem at the same time... or even an idea of where to look for.

Test Case

Clicking on a <Link /> in a header

Steps to reproduce

Working on it

Expected Behavior

The active style being added to the Link I just clicked and removed from the Link of the route we just left.

Actual Behavior

Rendering the right component but since no props changed in my header's Link they don't re-render. By adding Link.componentDidMount = () => this.context.router.listen(this.render.bind(this)) it re-render but is always keeping the active style once it has been active once.

@yormi
Copy link
Author

yormi commented Jun 8, 2016

After using JSBin, the problem doesn't reproduce, so the problem is probably coming from the combinaison with react-router-redux or just in my set-up. I'll continue to work on that

http://jsbin.com/dezofayagu/1/edit?html,js,output

@yormi yormi closed this as completed Jun 8, 2016
@gaulucky92
Copy link

I got this issue too, and after searching for the answer, I think it might be something related to Redux. As being discussed at #3536 , a container component which is wrapped by Redux's connect() will make all the Links in it fail to change their active state. Also in the comment section @mertkahyaoglu said that he would simply put an option {pure: false} to connect() but it does not work for me.

@yormi
Copy link
Author

yormi commented Jun 16, 2016

Thanks for the info mate :D

I don't know if you've seen but they said that the problem should be fix with react-router@next and 3.0. It worked for me :)

Cheers gaulucky !

@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants