mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-14 12:14:40 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad85a78350 | ||
|
|
892d167ff1 |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,6 +1,19 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
## v0.10.5
|
||||
|
||||
[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.4...v0.10.5)
|
||||
|
||||
|
||||
### 🚀 Enhancements
|
||||
|
||||
- Pass input to watched sources if it's a ref ([892d167](https://github.com/wobsoriano/trpc-nuxt/commit/892d167))
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Wobsoriano ([@wobsoriano](http://github.com/wobsoriano))
|
||||
|
||||
## v0.10.4
|
||||
|
||||
[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.3...v0.10.4)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"description": "End-to-end typesafe APIs in Nuxt applications.",
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@8.5.1",
|
||||
"version": "0.10.4",
|
||||
"version": "0.10.5",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
|
||||
@@ -6,9 +6,7 @@ const id = ref(1)
|
||||
// watch: [id]
|
||||
// })
|
||||
|
||||
const { data: todo, pending, error, refresh } = await $client.todo.getTodo.useQuery(id, {
|
||||
watch: [id],
|
||||
})
|
||||
const { data: todo, pending, error, refresh } = await $client.todo.getTodo.useQuery(id)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared'
|
||||
import { hash } from 'ohash'
|
||||
import { type DecoratedProcedureRecord } from './types'
|
||||
// @ts-expect-error: Nuxt auto-imports
|
||||
import { getCurrentInstance, onScopeDispose, useAsyncData, unref } from '#imports'
|
||||
import { getCurrentInstance, onScopeDispose, useAsyncData, unref, isRef } from '#imports'
|
||||
|
||||
/**
|
||||
* Calculates the key used for `useAsyncData` call.
|
||||
@@ -58,7 +58,10 @@ export function createNuxtProxyDecoration<TRouter extends AnyRouter> (name: stri
|
||||
return useAsyncData(queryKey, () => (client as any)[path].query(unref(input), {
|
||||
signal: controller?.signal,
|
||||
...trpc
|
||||
}), asyncDataOptions)
|
||||
}), {
|
||||
...asyncDataOptions,
|
||||
watch: isRef(input) ? [...(asyncDataOptions.watch || []), input] : asyncDataOptions.watch
|
||||
})
|
||||
}
|
||||
|
||||
return (client as any)[path][lastArg](...args)
|
||||
|
||||
Reference in New Issue
Block a user