pl-hooks: Improve useInstance behavior
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
12eb4d820a
commit
36cc2e103a
1 changed files with 3 additions and 2 deletions
|
@ -5,7 +5,7 @@ import * as v from 'valibot';
|
||||||
import { usePlHooksApiClient } from 'pl-hooks/contexts/api-client';
|
import { usePlHooksApiClient } from 'pl-hooks/contexts/api-client';
|
||||||
import { usePlHooksQueryClient } from 'pl-hooks/contexts/query-client';
|
import { usePlHooksQueryClient } from 'pl-hooks/contexts/query-client';
|
||||||
|
|
||||||
const placeholderData = v.parse(instanceSchema, {});
|
const initialData = v.parse(instanceSchema, {});
|
||||||
|
|
||||||
const useInstance = () => {
|
const useInstance = () => {
|
||||||
const { client } = usePlHooksApiClient();
|
const { client } = usePlHooksApiClient();
|
||||||
|
@ -14,7 +14,8 @@ const useInstance = () => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['instance'],
|
queryKey: ['instance'],
|
||||||
queryFn: client.instance.getInstance,
|
queryFn: client.instance.getInstance,
|
||||||
placeholderData,
|
initialData,
|
||||||
|
initialDataUpdatedAt: -1,
|
||||||
}, queryClient);
|
}, queryClient);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue