-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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(router): beforeEnter is not triggered for initial navigation #22936
Comments
Thanks for the issue. Can you try the following dev build and let me know if it resolves the issue? Using NPM:
Using CDN:
|
@liamdebeasi Thanks a lot for the super quickly fixing it. I have tested it in the attached runkit and in my app and it works great ! (no more need for the workaround I mentioned). I left a couple of minor comments on the PR. |
Thanks for the issue. This has been resolved via #23123, and a fix will be available in an upcoming release of Ionic Framework. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Bug Report
Ionic version:
[ ] 4.x
[x] 5.5.4
Current behavior:
I have a simple project with two routes
/foo
and/bar
.When I navigate to them via
<ion-item button href=...>
thebeforeEnter
hook is called as expected.However when I visit navigate to my project by typing the url
http://<site>/bar
then thebeforeEnter
hook is not called.I think this behavior is not expected ?
At least it could be a pain if you want to lazy-load the component in the
beforeEnter
hook (or check authentication, ...)Expected behavior:
The
beforeEnter
hook should be called when directly navigating to the url, i.e.http://<site>/bar
Steps to reproduce:
beforeEnter
logs in the console<ion-nav>
is updated as expected but thebeforeEnter
is not triggered (no logs).Workaround:
A workaround would be to force an initial navigation after the router is loaded:
The text was updated successfully, but these errors were encountered: