-
Notifications
You must be signed in to change notification settings - Fork 240
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
Child route has been remounted #58
Comments
yeah same issue here |
So if you are navigating to a subroute, even when you are authenticated, the parent mounts and then unmounts? Is it first sending you to the login page? I added some logging locally to the basic example with a nested route example and I couldn't reproduce this. Do you have a small example I could look at? The routes you included don't have this issue, but I have seen some weird mounting/unmounting behavior when people use dynamic routing (i.e. |
Hi @mjrussell , sorry for the late reply. To reproduce this, i forked a standalone project and commit some change. Then, if you are navigating to the "ProtectedSubView" subroute by clicking the "Attempt to access the protected sub view" link in the HomeView, you'll reproduce this problem.
|
Thank you for the example, that was a good start. I got to the bottom of this, it is related to how the <span>
<ResourcePage />
</span> and then once authenticated: <ResourcePage /> Obviously I think that is unintuitive for most users, but I would also say that unless you specifically want to display some Component during loading (i.e. logging in) you don't need the authenticatingSelector at all. |
ah i see! was having the same issue.... yeah i feel that is super unintuitive. |
This resolve my problem, thank you! |
Yeah Im going to change the default loading component to drop all props passed into it and release a new version shortly. It will complain loading in react 15.2 as is also due to unknown props |
Not necessarily true, on startup I have to check whether my login session is still valid, which is a async check. I now use the authenticatingSelector to handle this. |
@peteruithoven can you explain a little more about what you are doing? You shouldn't be performing any side effects inside the authenticating selector. The authors of react-redux have said that performing a side effect in their |
I'm not, the selectors just check the state. When starting there is a async check whether the session is still valid. While doing this there is a isPending boolean in the state, that my authenticating selector checks. My isAuthenticated simply checks whether there is session data, but it doesn't know whether it's checked. So by combining the 2 selectors I get what I want. |
Oops you are right, I wasn't thinking correctly for a minute there. Yup makes sense and that was the original intent of the |
Released 0.7.0 which fixes this |
Hi @mjrussell, this is my routes config.
When the browser's url match the resource page route such as "/dashboard/osds", the "ResourcePage" component has been mounted twice. And the second one was occurred after the "GET_CLUSTER_INSTALLATION_SUCCESS" redux action.
This is my console log:
What can i do if i don't want the "ResourcePage" be remount?
The text was updated successfully, but these errors were encountered: