-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Bug?]: Routes infinitely redirect users after upgrading to Redwood v6 #9131
Comments
Hey @ahoopes16, thanks for reporting and the reproduction steps, I can reproduce it! Investigating now. |
I'm so glad I'm not going crazy! Thank you for taking a look. |
@ahoopes16 brought this up to the team today—we identified the reason for the bug. In v6, many router components like Set and Private became "virtual" in the sense that they aren't rendered as written, but are used as a kind of DSL though that description is probably taking it too far. (Their wrap props get rendered of course.) But in doing this we ignored the nested sequence of authentication/role checks. As a result, only the nearest Set/Private component is being used, instead of them being processed in sequence as originally intended. We'll fix this in a patch! |
@jtoar Fantastic, thanks so much for the quick triage information! I look forward to the patch. |
Fix for #9131 This handles use cases where there are multiple nested routes with different levels of authentication and redirect contexts --------- Co-authored-by: Daniel Choudhury <dannychoudhury@gmail.com>
Fix for #9131 This handles use cases where there are multiple nested routes with different levels of authentication and redirect contexts --------- Co-authored-by: Daniel Choudhury <dannychoudhury@gmail.com>
Fix for #9131 This handles use cases where there are multiple nested routes with different levels of authentication and redirect contexts --------- Co-authored-by: Daniel Choudhury <dannychoudhury@gmail.com>
@ahoopes16 sorry it took much longer than anticipated, but this fix just landed in v6.4 |
No worries, thanks so much for getting it fixed at all! My users will be thrilled. 😄 |
What's not working?
Hello there,
I started my project using Redwood v5, and my routes are setup like this:
While I was still using RedwoodJS v5, the
unauthenticated
androles
parameters worked exactly as expected. If a user was logged in with only the "Employee" or only the "Administrator" role, they could only access their respective routes, and if they tried to access one of the other roles' routes they would automatically get redirected to their pages. If a user was logged in but had no roles, they would be navigated to the No Roles Assigned Page. If a user was not logged in but tried to access any of the inner routes they would automatically get redirected to the login page.After upgrading to Redwood v6, if I try to access the
/employee
route without being logged in, it gets stuck in an infinite loop redirecting between/employee
and/admin
.Is there a different way that I need to organize these routes in Redwood v6 to get the same behavior I used to have? Or is this a true defect in how the routing is handled now?
How do we reproduce the bug?
It seems like as long as you have your routes in a similar configuration to the one that I posted above, you should run into this issue.
<Set private unauthenticated="home" />
set of routesnoRolesAssigned
inside theSet
from step 2<Set private unauthenticated="noRolesAssigned />
inside that first setSet
, add two<Private />
components, one for each of 2 roles in your systemPrivate
tag, add props that set theroles
prop to one of the roles and then set theunauthenticated
prop to a page inside the otherPrivate
tagPrivate
routeshome
pageWhat's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: