Skip to content

useAsyncData breaks after clientside navigation when using a reactive keys #33777

@lutejka

Description

@lutejka

Environment


  • Operating System: Linux
  • Node Version: v20.19.1
  • Nuxt Version: 4.2.1
  • CLI Version: 3.30.0
  • Nitro Version: 2.12.9
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-nhdzmhlj-lxdcv2lt?file=app%2Fcomposables%2FuseData.ts

Describe the bug

We recently refactored our data fetching composables (wrappers around useAsyncData) to support MaybeRefOrGetter for the key generation, aligning with Nuxt's native functionality.

Previously, we used template literals ("ID-${productId}") to create unique keys. Now we updated it to use getter functions.

We now noticed that after client side navigation is performed, the new data is not fetched anymore.

When you look in the repoduction link you'll see that on inital load updating the query param works fine. When you navigate to a different ID and then update the query param, the data stays the same.

When I change the key back to a template literal, everything stays working

Additional context

No response

Logs

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions