openapi-ts icon indicating copy to clipboard operation
openapi-ts copied to clipboard

[nuxt-client] Better key handling

Open lvaroqui opened this issue 9 months ago • 0 comments

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 avatar May 07 '25 21:05 lvaroqui