pl-hooks: actually improve useInstance behavior
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
36cc2e103a
commit
ad7527bd4d
1 changed files with 3 additions and 3 deletions
|
@ -11,12 +11,12 @@ const useInstance = () => {
|
||||||
const { client } = usePlHooksApiClient();
|
const { client } = usePlHooksApiClient();
|
||||||
const queryClient = usePlHooksQueryClient();
|
const queryClient = usePlHooksQueryClient();
|
||||||
|
|
||||||
return useQuery({
|
const query = useQuery({
|
||||||
queryKey: ['instance'],
|
queryKey: ['instance'],
|
||||||
queryFn: client.instance.getInstance,
|
queryFn: client.instance.getInstance,
|
||||||
initialData,
|
|
||||||
initialDataUpdatedAt: -1,
|
|
||||||
}, queryClient);
|
}, queryClient);
|
||||||
|
|
||||||
|
return { ...query, data: query.data || initialData };
|
||||||
};
|
};
|
||||||
|
|
||||||
export { useInstance };
|
export { useInstance };
|
||||||
|
|
Loading…
Reference in a new issue