-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Page loading triggered when navigating to same page with different fragment #27157
Comments
hello, @manniL ! Can I solve this problem? |
@uniqueeest Sure, go ahead |
@manniL Should I stop the move from nuxtlink to # altogether? |
@uniqueeest no no, the main part is not triggering the loading indicator if only the hash is different |
@manniL sorry. I'm a beginner, so I don't know where to fix it 😢 |
@uniqueeest Take a look at this PR as a starting point. Changing the logic there to "ignore" differences between the fragment should be fine |
Actually, the reproduction is not using the NuxtLoadingIndicator nor |
Re-opening as the "actual issue" is valid though (+renamed the title) |
The issue is here that vue router regards this as a 'navigation' event, so it will trigger middleware - and it is even possible to force reloading the page in this case (with a custom We start the loading when middleware begins, because if middleware perform data fetching this should be shown as part of the page loading. As long as these two things are the case, I think it is correct that this triggers a loading event. Because you are creating a custom integration with the |
Environment
Reproduction
https://codesandbox.io/p/devbox/nuxt-link-test-fqzqn9
Describe the bug
When using NuxtLink components within a Nuxt 3 project, I've noticed that clicking on a NuxtLink with "#" as the value (e.g.,
<NuxtLink to="#">)
triggers the 'page:loading:start' hook, even when navigating to the same page. This behavior is unexpected and can be confusing for users.You can observe the loading even if you're already on the current page by clicking on the links (anchor links) provided in the example (https://codesandbox.io/p/devbox/nuxt-link-test-fqzqn9).
Additional context
I believe that clicking on a NuxtLink component with "#" as the value should not trigger the loading indicator, as it indicates navigation to the same page. This behavior should be consistent with user expectations and improve the overall user experience.
Thank you for your attention to this matter.
Logs
No response
The text was updated successfully, but these errors were encountered: