Compare commits

...

6 Commits

Author SHA1 Message Date
wobsoriano
bec300b750 chore(release): v0.10.6 2023-07-09 17:38:40 -07:00
wobsoriano
7bbe767495 bump local deps 2023-07-09 17:38:07 -07:00
wobsoriano
811a634010 chore(deps): update ofetch to 1.1.1 2023-07-09 17:36:54 -07:00
wobsoriano
12d8c97f71 chore(deps): update h3 to 1.7.1 2023-07-09 17:36:23 -07:00
wobsoriano
ad85a78350 chore(release): v0.10.5 2023-05-27 06:13:49 -07:00
wobsoriano
892d167ff1 feat: pass input to watched sources if it's a ref 2023-05-27 06:13:45 -07:00
7 changed files with 1139 additions and 1607 deletions

View File

@@ -1,6 +1,23 @@
# Changelog # Changelog
## v0.10.6
[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.5...v0.10.6)
## 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 ## v0.10.4
[compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.3...v0.10.4) [compare changes](https://github.com/wobsoriano/trpc-nuxt/compare/v0.10.3...v0.10.4)

View File

@@ -8,8 +8,8 @@
"preview": "nuxi preview" "preview": "nuxi preview"
}, },
"devDependencies": { "devDependencies": {
"@nuxt-themes/docus": "^1.12.0", "@nuxt-themes/docus": "^1.13.1",
"@nuxtlabs/github-module": "^1.6.3", "@nuxtlabs/github-module": "^1.6.3",
"nuxt": "3.4.3" "nuxt": "3.6.2"
} }
} }

View File

@@ -2,8 +2,8 @@
"name": "trpc-nuxt", "name": "trpc-nuxt",
"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.5.1", "packageManager": "pnpm@8.6.7",
"version": "0.10.4", "version": "0.10.6",
"license": "MIT", "license": "MIT",
"sideEffects": false, "sideEffects": false,
"exports": { "exports": {
@@ -39,20 +39,20 @@
"@trpc/server": "^10.26.0" "@trpc/server": "^10.26.0"
}, },
"dependencies": { "dependencies": {
"h3": "^1.6.6", "h3": "^1.7.1",
"ofetch": "^1.0.1", "ofetch": "^1.1.1",
"ohash": "^1.1.2", "ohash": "^1.1.2",
"ufo": "^1.1.2" "ufo": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@nuxt/eslint-config": "^0.1.1", "@nuxt/eslint-config": "^0.1.1",
"@trpc/client": "^10.28.0", "@trpc/client": "^10.34.0",
"@trpc/server": "^10.28.0", "@trpc/server": "^10.34.0",
"changelogen": "^0.5.3", "changelogen": "^0.5.4",
"eslint": "^8.41.0", "eslint": "^8.44.0",
"taze": "^0.10.1", "taze": "^0.11.2",
"tsup": "6.7.0", "tsup": "7.1.0",
"typescript": "^5.0.4" "typescript": "^5.1.6"
}, },
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [
@@ -75,7 +75,7 @@
], ],
"pnpm": { "pnpm": {
"overrides": { "overrides": {
"nuxt": "3.4.3" "nuxt": "3.6.2"
} }
} }
} }

View File

@@ -9,14 +9,14 @@
"postinstall": "nuxt prepare" "postinstall": "nuxt prepare"
}, },
"dependencies": { "dependencies": {
"@trpc/client": "^10.28.0", "@trpc/client": "^10.34.0",
"@trpc/server": "^10.28.0", "@trpc/server": "^10.34.0",
"superjson": "^1.12.3", "superjson": "^1.12.4",
"trpc-nuxt": "workspace:*", "trpc-nuxt": "workspace:*",
"zod": "^3.21.4" "zod": "^3.21.4"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.16.15", "@types/node": "^20.4.1",
"nuxt": "3.4.3" "nuxt": "3.6.2"
} }
} }

View File

@@ -6,9 +6,7 @@ const id = ref(1)
// watch: [id] // watch: [id]
// }) // })
const { data: todo, pending, error, refresh } = await $client.todo.getTodo.useQuery(id, { const { data: todo, pending, error, refresh } = await $client.todo.getTodo.useQuery(id)
watch: [id],
})
</script> </script>
<template> <template>

2680
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@ import { createFlatProxy, createRecursiveProxy } from '@trpc/server/shared'
import { hash } from 'ohash' import { hash } from 'ohash'
import { type DecoratedProcedureRecord } from './types' import { type DecoratedProcedureRecord } from './types'
// @ts-expect-error: Nuxt auto-imports // @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. * 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), { return useAsyncData(queryKey, () => (client as any)[path].query(unref(input), {
signal: controller?.signal, signal: controller?.signal,
...trpc ...trpc
}), asyncDataOptions) }), {
...asyncDataOptions,
watch: isRef(input) ? [...(asyncDataOptions.watch || []), input] : asyncDataOptions.watch
})
} }
return (client as any)[path][lastArg](...args) return (client as any)[path][lastArg](...args)