Skip to content

[nuxt-client] Better key handling #2025

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

Open
lvaroqui opened this issue May 7, 2025 · 0 comments
Open

[nuxt-client] Better key handling #2025

lvaroqui opened this issue May 7, 2025 · 0 comments
Labels
feature 🚀 New feature or request

Comments

@lvaroqui
Copy link

lvaroqui commented May 7, 2025

Description

As can be read in Nuxt doc here:

key: a unique key to ensure that data fetching can be properly de-duplicated across requests. If you do not provide a key, then a key that is unique to the file name and line number of the instance of useAsyncData will be generated for you.

The key argument is crutial for useAsyncData to work properly. Currently, in heyapi client, if the user does not pass a key, I believe the same key will be used for all uses of useAsyncData composable which can cause really odd behaviors (I had a function call the wrong route because of it).

I think that either:

  • the key argument should be necessary
  • automatically fill by default (possibly with the name of the route + HTTP method?)

I think option 2 is preferrable but I may miss something!

@lvaroqui lvaroqui added the feature 🚀 New feature or request label May 7, 2025
@lvaroqui lvaroqui changed the title [nuxt-client] [nuxt-client] Better key handling May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🚀 New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant