From 0f315a5408336e52147a92274c3030c7a4a72365 Mon Sep 17 00:00:00 2001 From: Paul Sachs <11449728+paul-sachs@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:22:57 -0400 Subject: [PATCH] V2: Remove queryKeyHashFn to allow default query client access to queries (#470) If we customize the queryKeyHashFn, it prevents `queryClient.setQueryData` from finding the query in question, unless the `queryClient` was initialized with the same queryKeyHashFn. It would be nice to be able to customize this on a per query basis but [it doesn't seem to be an accepted approach](https://github.com/TanStack/query/issues/2352#issuecomment-2422530700). --------- Signed-off-by: Paul Sachs --- packages/connect-query/src/create-infinite-query-options.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/connect-query/src/create-infinite-query-options.ts b/packages/connect-query/src/create-infinite-query-options.ts index aa4e9909..0681692e 100644 --- a/packages/connect-query/src/create-infinite-query-options.ts +++ b/packages/connect-query/src/create-infinite-query-options.ts @@ -22,7 +22,6 @@ import type { Transport } from "@connectrpc/connect"; import type { GetNextPageParamFunction, QueryFunction, - QueryKey, SkipToken, } from "@tanstack/react-query"; import { skipToken } from "@tanstack/react-query"; @@ -117,7 +116,6 @@ export function createInfiniteQueryOptions< | SkipToken; structuralSharing: (oldData: unknown, newData: unknown) => unknown; initialPageParam: MessageInitShape[ParamKey]; - queryKeyHashFn: (queryKey: QueryKey) => string; } { const queryKey = createConnectQueryKey({ cardinality: "infinite", @@ -141,6 +139,5 @@ export function createInfiniteQueryOptions< queryKey, queryFn, structuralSharing, - queryKeyHashFn: JSON.stringify, }; }