mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
fixed node related status
This commit is contained in:
parent
0bc2ff250f
commit
7d7afeeaf5
1 changed files with 3 additions and 4 deletions
|
@ -6,12 +6,11 @@ import { useCallback } from 'react';
|
|||
import { apiGetNodeRelated } from '~/redux/node/api';
|
||||
|
||||
export const useGetNodeRelated = (id?: INode['id']) => {
|
||||
const { data, isValidating: isLoading, mutate } = useSWR<ApiGetNodeRelatedResult>(
|
||||
API.NODE.RELATED(id),
|
||||
() => apiGetNodeRelated({ id })
|
||||
const { data, isValidating, mutate } = useSWR<ApiGetNodeRelatedResult>(API.NODE.RELATED(id), () =>
|
||||
apiGetNodeRelated({ id })
|
||||
);
|
||||
|
||||
const refresh = useCallback(() => mutate(data, true), [data, mutate]);
|
||||
|
||||
return { related: data?.related, isLoading, refresh };
|
||||
return { related: data?.related, isLoading: isValidating && !data, refresh };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue