nuxt / nuxt

The Intuitive Vue Framework.

Home Page:https://nuxt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Page loading triggered when navigating to same page with different fragment

lhoucinecherif opened this issue · comments

Environment

  • Operating System: Linux
  • Node Version: v20.9.0
  • Nuxt Version: 3.10.0
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@9.8.1
  • Builder: -
  • User Config: css, devtools
  • Runtime Modules: -
  • Build Modules: -

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

hello, @manniL ! Can I solve this problem?

@uniqueeest Sure, go ahead ☺️

@manniL Should I stop the move from nuxtlink to # altogether?