-
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
Wrapper fails to redirect on initial load #49
Comments
@jcheroske hmm thats interesting...can you paste your auth wrapper config? (or even more of your code if you can) I did refactor the willMount logic slightly in 0.5.1 but I have a test for the the initial load that I would think cover this case you are describing. |
Reproduced this issue as well. upd: |
So the main change in 0.5.1 is to prevent infinite redirect loops which became more noticeable in react 15.1. The core of the issue is that previously to 0.5.1 the auth-wrapper library would call the redirect any time @jcheroske @Windstalker Are either of you using the |
@mjrussell Yes, I use it. Here is my config: UserAuthWrapper({
authSelector: (state) => {
const { auth, user } = state;
return { auth, user };
},
predicate: (authState) => {
const { auth, user } = authState;
return auth.accessToken.length && user.profile !== null;
},
authenticatingSelector: ({ session, user, auth }) => {
const flag = !session.sessionReady || (auth.accessToken.length && user.profile === null);
return flag;
},
redirectAction: routerActions.replace
}); On
AuthWrapped.componentWillMount() // Spinner rendered
AuthWrapped.componentWillReceiveProps() // Spinner rendered
AuthWrapped.componentWillReceiveProps() // Empty rendered
|
@Windstalker ok thanks this is perfect. I see the error that was introduced. The I'll work on this today and get a new version out tonight that fixes this issue. |
@mjrussell Would be great, thanks! |
You guys are on this! But, since I opened the dang thing, yes, I'm using the
Thank you so much for the quick turnaround. |
Fix released in 0.5.2. Thanks for the help on this |
I believe this is a regression introduced in 0.5.1. It disappears completely when I roll back to 0.5.0.
If the
authSelector
returns null on the initial load of the page, the protected content will not load, but the configured redirect will fail to occur. If I login, the content will be correctly displayed. If I logout the correct redirect will take place.The text was updated successfully, but these errors were encountered: