pl-hooks: Improve useInstance behavior

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-26 19:53:26 +02:00
parent 12eb4d820a
commit 36cc2e103a

View file

@ -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);
};