From 36c77f3a25fe7f45cd22ab2c9873119839896f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ti=E1=BA=BFn=20Nguy=E1=BB=85n=20Kh=E1=BA=AFc?= Date: Fri, 5 Jul 2024 19:20:20 +1200 Subject: [PATCH] refactor: make query initial instructions optional --- packages/core/src/QueryBuilder.ts | 2 +- packages/react/src/hooks/useQuery.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/QueryBuilder.ts b/packages/core/src/QueryBuilder.ts index ccb89b93..9258fe13 100644 --- a/packages/core/src/QueryBuilder.ts +++ b/packages/core/src/QueryBuilder.ts @@ -217,7 +217,7 @@ export default class Query< { #instructions: TInstructions; - constructor(instructions: TInstructions) { + constructor(instructions: TInstructions = [] as unknown as TInstructions) { this.#instructions = instructions; } diff --git a/packages/react/src/hooks/useQuery.ts b/packages/react/src/hooks/useQuery.ts index 15c05cb3..fbc01ea3 100644 --- a/packages/react/src/hooks/useQuery.ts +++ b/packages/react/src/hooks/useQuery.ts @@ -46,7 +46,7 @@ export function useQueryRefresher< return; } - const query = builder(new Query([])); + const query = builder(new Query()); if (!query) { return; @@ -102,7 +102,7 @@ export function useLazyLoadQueryWithRefresh< const chainId = useChainId(options); const query = useMemo( - () => (!builder ? undefined : builder(new Query([]))), + () => (!builder ? undefined : builder(new Query())), [builder], );