fixed tRPC createInfiniteQuery no refresh when input change #1

This commit is contained in:
OrJDev
2022-10-17 00:06:57 +03:00
parent c7f622a0cc
commit c613af8d9a
3 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -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",
+1 -1
View File
@@ -3,7 +3,7 @@
"description": "SolidJS tRPC",
"author": "OrJDev",
"license": "MIT",
"version": "0.0.8",
"version": "0.0.9",
"publishConfig": {
"access": "public"
},
+5 -4
View File
@@ -176,9 +176,7 @@ export function createSolidQueryHooks<TRouter extends AnyRouter>() {
TError
>
): CreateInfiniteQueryResult<TQueryValues[TPath]["output"], TError> {
const [path, input] = pathAndInput();
const ctx = useContext();
if (
typeof window === "undefined" &&
opts?.enabled !== false &&
@@ -190,9 +188,12 @@ export function createSolidQueryHooks<TRouter extends AnyRouter>() {
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