fix: folders call when saving flow (#3658)
* Removed refetching of get folder on save * Made component appear if its loading * Rebaned query key to not refetch folders * Changed isLoading to isFetching for the component to be unclickable while refetching
This commit is contained in:
parent
27ad129049
commit
61e5bbb482
4 changed files with 10 additions and 13 deletions
|
|
@ -33,14 +33,7 @@ export const usePatchUpdateFlow: useMutationFunctionType<
|
|||
};
|
||||
|
||||
const mutation: UseMutationResult<IPatchUpdateFlow, any, IPatchUpdateFlow> =
|
||||
mutate(["usePatchUpdateFlow"], PatchUpdateFlowFn, {
|
||||
...options,
|
||||
onSettled: () => {
|
||||
queryClient.refetchQueries({
|
||||
queryKey: ["useGetFolder"],
|
||||
});
|
||||
},
|
||||
});
|
||||
mutate(["usePatchUpdateFlow"], PatchUpdateFlowFn, options);
|
||||
|
||||
return mutation;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ export const useGetDownloadFolders: useMutationFunctionType<
|
|||
return res.data;
|
||||
};
|
||||
|
||||
const mutation = mutate(["useGetFolders"], downloadFoldersFn, options);
|
||||
const mutation = mutate(
|
||||
["useGetDownloadFolders"],
|
||||
downloadFoldersFn,
|
||||
options,
|
||||
);
|
||||
return mutation;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ export default function ComponentsComponent({
|
|||
<EmptyComponent />
|
||||
) : (
|
||||
<div className="grid w-full gap-4 md:grid-cols-2 lg:grid-cols-2">
|
||||
{data?.length > 0 && isLoading === false ? (
|
||||
{data?.length > 0 ? (
|
||||
<>
|
||||
{data?.map((item) => (
|
||||
<FormProvider {...methods} key={item.id}>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const MyCollectionComponent = ({ type }: MyCollectionComponentProps) => {
|
|||
const { folderId } = useParams();
|
||||
const myCollectionId = useFolderStore((state) => state.myCollectionId);
|
||||
|
||||
const { data, isLoading } = useGetFolderQuery(
|
||||
const { data, isFetching } = useGetFolderQuery(
|
||||
{
|
||||
id: folderId ?? myCollectionId ?? "",
|
||||
},
|
||||
|
|
@ -27,13 +27,13 @@ const MyCollectionComponent = ({ type }: MyCollectionComponentProps) => {
|
|||
|
||||
return (
|
||||
<>
|
||||
<HeaderTabsSearchComponent loading={isLoading || isLoadingFolders} />
|
||||
<HeaderTabsSearchComponent loading={isFetching || isLoadingFolders} />
|
||||
<div className="mt-5 flex h-full flex-col">
|
||||
<ComponentsComponent
|
||||
key={type}
|
||||
type={type}
|
||||
currentFolder={data}
|
||||
isLoading={isLoading || isLoadingFolders}
|
||||
isLoading={isFetching || isLoadingFolders}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue