Compare commits

..

2 Commits

Author SHA1 Message Date
wobsoriano
ede749414d chore(release): v0.10.9 2023-08-20 22:51:01 -07:00
wobsoriano
f2bcf9b68b feat: add custom query key option 2023-08-20 22:50:48 -07:00
4 changed files with 23 additions and 4 deletions

View File

@@ -1,6 +1,18 @@
# Changelog
## v0.10.9
[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.8...v0.10.9)
### 🚀 Enhancements
- Add custom query key option ([f2bcf9b](https://github.com/wobsoriano/trpc-nuxt/commit/f2bcf9b))
### ❤️ Contributors
- Wobsoriano ([@wobsoriano](http://github.com/wobsoriano))
## v0.10.8
[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.7...v0.10.8)

View File

@@ -3,7 +3,7 @@
"description": "End-to-end typesafe APIs in Nuxt applications.",
"type": "module",
"packageManager": "pnpm@8.6.9",
"version": "0.10.8",
"version": "0.10.9",
"license": "MIT",
"sideEffects": false,
"exports": {

View File

@@ -41,7 +41,7 @@ export function createNuxtProxyDecoration<TRouter extends AnyRouter> (name: stri
const [input, otherOptions] = args
if (lastArg === 'useQuery') {
const { trpc, ...asyncDataOptions } = otherOptions || {} as any
const { trpc, queryKey: customQueryKey, ...asyncDataOptions } = otherOptions || {} as any
let controller: AbortController
@@ -54,7 +54,7 @@ export function createNuxtProxyDecoration<TRouter extends AnyRouter> (name: stri
controller = typeof AbortController !== 'undefined' ? new AbortController() : {} as AbortController
}
const queryKey = getQueryKey(path, unref(input))
const queryKey = customQueryKey || getQueryKey(path, unref(input))
return useAsyncData(queryKey, () => (client as any)[path].query(unref(input), {
signal: controller?.signal,
...trpc

View File

@@ -59,7 +59,14 @@ type DecorateProcedure<
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
>(
input: MaybeRef<inferProcedureInput<TProcedure>>,
opts?: AsyncDataOptions<ResT, DataT, PickKeys> & { trpc?: TRPCRequestOptions },
opts?: AsyncDataOptions<ResT, DataT, PickKeys> & {
trpc?: TRPCRequestOptions
/**
* The custom unique key to use.
* @see https://nuxt.com/docs/api/composables/use-async-data#params
*/
queryKey?: string
},
) => AsyncData<PickFrom<DataT, PickKeys> | null, DataE>,
query: Resolver<TProcedure>
} : TProcedure extends AnyMutationProcedure ? {