mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-24 17:00:32 +01:00
feat: never cache mutation
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"h3": "^0.8.5",
|
"h3": "^0.8.5",
|
||||||
|
"nanoid": "^4.0.0",
|
||||||
"ohash": "^0.1.5",
|
"ohash": "^0.1.5",
|
||||||
"ufo": "^0.8.6"
|
"ufo": "^0.8.6"
|
||||||
},
|
},
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -12,6 +12,7 @@ importers:
|
|||||||
concurrently: ^7.5.0
|
concurrently: ^7.5.0
|
||||||
eslint: ^8.25.0
|
eslint: ^8.25.0
|
||||||
h3: ^0.8.5
|
h3: ^0.8.5
|
||||||
|
nanoid: ^4.0.0
|
||||||
nuxt: 3.0.0-rc.12
|
nuxt: 3.0.0-rc.12
|
||||||
ohash: ^0.1.5
|
ohash: ^0.1.5
|
||||||
pnpm: ^7.14.1
|
pnpm: ^7.14.1
|
||||||
@@ -20,6 +21,7 @@ importers:
|
|||||||
ufo: ^0.8.6
|
ufo: ^0.8.6
|
||||||
dependencies:
|
dependencies:
|
||||||
h3: 0.8.6
|
h3: 0.8.6
|
||||||
|
nanoid: 4.0.0
|
||||||
ohash: 0.1.5
|
ohash: 0.1.5
|
||||||
ufo: 0.8.6
|
ufo: 0.8.6
|
||||||
devDependencies:
|
devDependencies:
|
||||||
@@ -6706,7 +6708,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-IgBP8piMxe/gf73RTQx7hmnhwz0aaEXYakvqZyE302IXW3HyVNhdNGC+O2MwMAVhLEnvXlvKtGbtJf6wvHihCg==}
|
resolution: {integrity: sha512-IgBP8piMxe/gf73RTQx7hmnhwz0aaEXYakvqZyE302IXW3HyVNhdNGC+O2MwMAVhLEnvXlvKtGbtJf6wvHihCg==}
|
||||||
engines: {node: ^14 || ^16 || >=18}
|
engines: {node: ^14 || ^16 || >=18}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dev: true
|
|
||||||
|
|
||||||
/natural-compare/1.4.0:
|
/natural-compare/1.4.0:
|
||||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type {
|
|||||||
import { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared'
|
import { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import { getCurrentInstance, onScopeDispose } from 'vue'
|
import { getCurrentInstance, onScopeDispose } from 'vue'
|
||||||
|
import { nanoid } from 'nanoid'
|
||||||
import type { DecoratedProcedureRecord } from './types'
|
import type { DecoratedProcedureRecord } from './types'
|
||||||
// @ts-expect-error: Nuxt auto-imports
|
// @ts-expect-error: Nuxt auto-imports
|
||||||
import { useAsyncData, useState } from '#imports'
|
import { useAsyncData, useState } from '#imports'
|
||||||
@@ -33,7 +34,7 @@ function createNuxtProxyDecoration<TRouter extends AnyRouter>(name: string, clie
|
|||||||
|
|
||||||
const [input, otherOptions] = args
|
const [input, otherOptions] = args
|
||||||
|
|
||||||
const queryKey = getQueryKey(path, input)
|
const queryKey = lastArg === 'mutate' ? nanoid() : getQueryKey(path, input)
|
||||||
|
|
||||||
const { trpc, ...asyncDataOptions } = otherOptions || {} as any
|
const { trpc, ...asyncDataOptions } = otherOptions || {} as any
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user