-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Updating from version 1.5.0 to ^1.6.0 breaks route redirect to child route #619
Comments
This seems to be linked to changes to _buildNavigationPlan in #623 and later. The GistRun is using an aurelia.js bundle prior to this version so can't reproduce it 👎 (is there an up to date version anywhere?) The STRs in the current aurelia/router are pretty simple: Top Level router: Go to: Expected redirect: Actual redirect: |
Try here. We're working on updating the documentation and getting this working better. |
Thanks for the feedback @RichTeaTime. We have created a new repo to replicate the issue as described with the latest packages. @davismj not sure about that link? Looks like it's got some react source in there..? |
Sorry about that, try again. |
No problem, you can see the issue replicated here: https://codesandbox.io/s/y735958pkv |
Updating the I remember having the exact same issue with @Krussicus please have a look if this works for you. |
@johan-v-r , this just changes the link to navigate directly to the child route, instead of using the While this works fine, if one is just after a nav link, it feels a bit wrong to set up a route in this case. |
As we're generating these redirects from handleUnknownRoute in the AppRouter, we're now working around this by redirecting to another page (e.g.
and this does work for redirecting to the child-router. Advantage with this is that it's just a one-liner that can be removed once this issue closes. For us, as our RouterConfigs are being generated that's the most simple workaround as we just wrap the return value from the handleUnknownRoutes callback, meaning that we can just remove this one line once this issue is fixed in the framework :-) |
I'm submitting a bug report
^1.6.0
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
9.0.0 (varies across my team but results are the same)
6.4.0 (varies across my team but results are the same)
Webpack 4.17.2
Browser:
Haven't tested every browser but confirmed for Chrome and Firefox
Language:
ESNext
Current behavior:
Using a route
redirect
to navigate to a nested(?) child route no longer works when updatingaurelia-router
from 1.5.0 to ^1.6.0. The broken behaviour varies slightly between the two patch-pre versions, 1.6.0 and 1.6.2, currently used within my company. Both versions seem to just silently fail, no errors emitted, and fallback to the default (blank) child route. Additionally, 1.6.2 appends the name(?) of the child route as a query string, e.g.childRoute=products
, to the URL.Several other packages also have differing version (I've supplied the
package-lock.json
files) so there's a chanceaurelia-router
is not the cause of the issue but it seems to be the most likely candidate.Expected/desired behavior:
What is the expected behavior?
I've created a Gist, which seems to work, to demonstrate the basic behaviour.
What is the motivation / use case for changing the behavior?
To be able to navigate to a child route using the main
router.navigation
, as per standard navbar implementation.I'm not sure how to update the packages for the Gist to reproduce the bug so I've provided the different
package-lock.json
files we're using along with thepackage.json
.npm-config.zip
If there are any alternative solutions that you can recommend for this use-case, I'm open to suggestions. I would prefer to keep the solution as simple as possible while achieving similar, if not the same, results.
I found this solution, which seems similar, but it seems overly complex compared to using a
redirect
. It also looks like there's a potential performance hit.Any help with this matter is appreciated.
Thanks in advanced for your time! :)
The text was updated successfully, but these errors were encountered: