Skip to content

callOnce navigation mode not working as expected #32811

@thenetwrx

Description

@thenetwrx

Environment

  • Operating System: Linux
  • Node Version: v20.12.1
  • Nuxt Version: 4.0.2
  • CLI Version: 3.27.0
  • Nitro Version: 2.12.4
  • Package Manager: npm@10.5.0
  • Builder: -
  • User Config: modules, compatibilityDate, devtools
  • Runtime Modules: @pinia/nuxt@0.11.2
  • Build Modules: -

Reproduction

https://github.com/thenetwrx/nuxt-callonce-repoduction

Describe the bug

callOnce composable with mode navigation doesn't re-execute it's callback when client side navigation occurs.

Additional context

I'm 99% sure the issue stems from the page:start hook, which only triggers when NuxtPage is rendered, it usually only occurs once in the user's visit lifecycle.

Coming from a nuxt error (either programmatically caused or an actual error), I've ascertained NuxtPage is forced to be re-rendered will and cause page:start to occur, which will of course execute callOnce again in nvaigation mode.

Unless I'm mistaken, callOnce navigation mode should occur on client side navigation, otherwise it would defeat the point?

Logs

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions