fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(client-nuxt): forward asyncDataOptions to useFetch and useLazyFetch

asyncDataOptions (e.g. { immediate: false }) was destructured out of
request options but only forwarded to useAsyncData/useLazyAsyncData.
The useFetch/useLazyFetch path silently ignored it, causing fetches
to fire immediately regardless of the immediate option.

Nuxt's useFetch accepts these options as top-level keys, so spreading
asyncDataOptions into the options object is the correct fix.

Closes #1966
Closes #1785

Your Name a4b73998 5627f122

+31 -26
+5
.changeset/fix-nuxt-async-data-options.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + **plugin(@hey-api/client-nuxt)**: fix: forward `asyncDataOptions` to `useFetch` and `useLazyFetch`
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/import-file-extension-ts/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-node16-sdk/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/client.gen.ts
··· 144 144 body.value = serializeBody(changed); 145 145 }); 146 146 return composable === 'useLazyFetch' 147 - ? useLazyFetch(() => buildUrl(opts), opts) 148 - : useFetch(() => buildUrl(opts), opts); 147 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 148 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 149 149 } 150 150 151 151 const handler: any = () =>
+2 -2
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts
··· 142 142 body.value = serializeBody(changed); 143 143 }); 144 144 return composable === 'useLazyFetch' 145 - ? useLazyFetch(() => buildUrl(opts), opts) 146 - : useFetch(() => buildUrl(opts), opts); 145 + ? useLazyFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }) 146 + : useFetch(() => buildUrl(opts), { ...opts, ...asyncDataOptions }); 147 147 } 148 148 149 149 const handler: any = () =>