From c613af8d9a850e4835a9822f9dabd93a11c802b1 Mon Sep 17 00:00:00 2001 From: OrJDev Date: Mon, 17 Oct 2022 00:06:57 +0300 Subject: [PATCH] fixed tRPC createInfiniteQuery no refresh when input change #1 --- package-lock.json | 4 ++-- package.json | 2 +- src/index.tsx | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index ebb6124..f793a01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "solid-trpc", - "version": "0.0.8", + "version": "0.0.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "solid-trpc", - "version": "0.0.8", + "version": "0.0.9", "license": "MIT", "devDependencies": { "@babel/core": "^7.18.13", diff --git a/package.json b/package.json index c7ca6e9..c5fb073 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "SolidJS tRPC", "author": "OrJDev", "license": "MIT", - "version": "0.0.8", + "version": "0.0.9", "publishConfig": { "access": "public" }, diff --git a/src/index.tsx b/src/index.tsx index 3745da5..e25ef9b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -176,9 +176,7 @@ export function createSolidQueryHooks() { TError > ): CreateInfiniteQueryResult { - const [path, input] = pathAndInput(); const ctx = useContext(); - if ( typeof window === "undefined" && opts?.enabled !== false && @@ -190,9 +188,12 @@ export function createSolidQueryHooks() { return __createInfiniteQuery( pathAndInput as any, ({ pageParam }) => { - const actualInput = { ...((input as any) ?? {}), cursor: pageParam }; + const actualInput = { + ...((pathAndInput()[1] as any) ?? {}), + cursor: pageParam, + }; return (ctx.client as any).query( - ...getClientArgs([path, actualInput], opts) + ...getClientArgs([pathAndInput()[0], actualInput], opts) ); }, opts as any