mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-27 02:10:35 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ede749414d | ||
|
|
f2bcf9b68b |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,6 +1,18 @@
|
|||||||
# Changelog
|
# 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
|
## v0.10.8
|
||||||
|
|
||||||
[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.7...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.",
|
"description": "End-to-end typesafe APIs in Nuxt applications.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"packageManager": "pnpm@8.6.9",
|
"packageManager": "pnpm@8.6.9",
|
||||||
"version": "0.10.8",
|
"version": "0.10.9",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export function createNuxtProxyDecoration<TRouter extends AnyRouter> (name: stri
|
|||||||
const [input, otherOptions] = args
|
const [input, otherOptions] = args
|
||||||
|
|
||||||
if (lastArg === 'useQuery') {
|
if (lastArg === 'useQuery') {
|
||||||
const { trpc, ...asyncDataOptions } = otherOptions || {} as any
|
const { trpc, queryKey: customQueryKey, ...asyncDataOptions } = otherOptions || {} as any
|
||||||
|
|
||||||
let controller: AbortController
|
let controller: AbortController
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ export function createNuxtProxyDecoration<TRouter extends AnyRouter> (name: stri
|
|||||||
controller = typeof AbortController !== 'undefined' ? new AbortController() : {} as AbortController
|
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), {
|
return useAsyncData(queryKey, () => (client as any)[path].query(unref(input), {
|
||||||
signal: controller?.signal,
|
signal: controller?.signal,
|
||||||
...trpc
|
...trpc
|
||||||
|
|||||||
@@ -59,7 +59,14 @@ type DecorateProcedure<
|
|||||||
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
|
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
|
||||||
>(
|
>(
|
||||||
input: MaybeRef<inferProcedureInput<TProcedure>>,
|
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>,
|
) => AsyncData<PickFrom<DataT, PickKeys> | null, DataE>,
|
||||||
query: Resolver<TProcedure>
|
query: Resolver<TProcedure>
|
||||||
} : TProcedure extends AnyMutationProcedure ? {
|
} : TProcedure extends AnyMutationProcedure ? {
|
||||||
|
|||||||
Reference in New Issue
Block a user