From 36cc2e103ae124183315bd4ac6d3ab05a1d7dbce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 26 Oct 2024 19:53:26 +0200 Subject: [PATCH] pl-hooks: Improve useInstance behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-hooks/lib/hooks/instance/use-instance.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/pl-hooks/lib/hooks/instance/use-instance.ts b/packages/pl-hooks/lib/hooks/instance/use-instance.ts index b39752145..1348b3396 100644 --- a/packages/pl-hooks/lib/hooks/instance/use-instance.ts +++ b/packages/pl-hooks/lib/hooks/instance/use-instance.ts @@ -5,7 +5,7 @@ import * as v from 'valibot'; import { usePlHooksApiClient } from 'pl-hooks/contexts/api-client'; import { usePlHooksQueryClient } from 'pl-hooks/contexts/query-client'; -const placeholderData = v.parse(instanceSchema, {}); +const initialData = v.parse(instanceSchema, {}); const useInstance = () => { const { client } = usePlHooksApiClient(); @@ -14,7 +14,8 @@ const useInstance = () => { return useQuery({ queryKey: ['instance'], queryFn: client.instance.getInstance, - placeholderData, + initialData, + initialDataUpdatedAt: -1, }, queryClient); };