Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upChildren routes components remount every route change #83
Comments
|
This has been raised before and should be seriously considered given the drawbacks |
|
Sorry, I had responded by mail a couple of days ago already - sadly my mail response appearently did not may its way here. But here is my original response: Without having looked deeply into your code: a huge warning sign is that you are re-creating new route objects upon each render of your components. Always declare your route objects as constants outside of your components. Its been written that way in the example as well - and there is even a note about this in the docs. I am 90% sure this will make your problem go away. |
|
Hi Paratron, thanks for maintaining this project :-) I'm having the same problem and it's not only due to re-creating new route objects. There was a change in router.js (8f3a178 - Do performance optimizations ).
As far as I can see this means that those are always null in process() now and the effect is that
Please have a look at this :-) |
|
Downgrading to 1.2.0 (which is before the mentioned change) solves the problem |
|
Thanks for pointing this out. I'll have a look. |
|
Having the same problem; downgrading to 1.2.0 also fixed it for me. I realize that in some cases performance hit is negligible, but when it comes to this like using CSS transitions for child components it becomes a deal-breaker issue. |
|
This bug bit me too late. I have routes in constants outside of function components. And nested routing produces re-rendering of the parent component when I switch to one of its sub-routes. And downgrading to 1.2.0 doesn't helps. |
|
Same problem here. Downgrading to 1.2.0 also fixed it for me. Here is a basic example of the problem in codesandbox.io |
|
If downgrading to 1.2.0 doesn't help then see if some ancestor component is using From the docs
|
I'm using the example in the documentation
If you try to change route the AboutArea component will mount on every route change.
This is a problem in the moment that I want to make api calls in the AboutArea component and share results with children.
am I doing something wrong or is an issue?