mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-14 20:19:33 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ede749414d | ||
|
|
f2bcf9b68b |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -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)
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ? {
|
||||
|
||||
Reference in New Issue
Block a user