diff --git a/src/frontend/src/stores/foldersStore.tsx b/src/frontend/src/stores/foldersStore.tsx index 190fc3212..ce858c3be 100644 --- a/src/frontend/src/stores/foldersStore.tsx +++ b/src/frontend/src/stores/foldersStore.tsx @@ -17,18 +17,18 @@ export const useFolderStore = create((set, get) => ({ getFolders().then( (res) => { const foldersWithoutStarterProjects = res?.filter( - (folder) => folder.name !== STARTER_FOLDER_NAME + (folder) => folder.name !== STARTER_FOLDER_NAME, ); const starterProjects = res?.find( - (folder) => folder.name === STARTER_FOLDER_NAME + (folder) => folder.name === STARTER_FOLDER_NAME, ); set({ starterProjectId: starterProjects!.id ?? "" }); set({ folders: foldersWithoutStarterProjects }); const myCollectionId = res?.find( - (f) => f.name === DEFAULT_FOLDER + (f) => f.name === DEFAULT_FOLDER, )?.id; set({ myCollectionId }); @@ -45,7 +45,7 @@ export const useFolderStore = create((set, get) => ({ set({ folders: [] }); get().setLoading(false); reject(error); - } + }, ); } }); @@ -54,24 +54,21 @@ export const useFolderStore = create((set, get) => ({ loading: false, setLoading: (loading) => set(() => ({ loading: loading })), getFolderById: (id) => { - get().setLoadingById(true); if (id) { getFolderById(id).then( (res) => { const setAllFlows = useFlowsManagerStore.getState().setAllFlows; setAllFlows(res.flows); set({ selectedFolder: res }); - get().setLoadingById(false); }, () => { - get().setLoadingById(false); - } + get().getFoldersApi(true); + }, ); } }, selectedFolder: null, loadingById: false, - setLoadingById: (loading) => set(() => ({ loadingById: loading })), getMyCollectionFolder: () => { const folders = get().folders; const myCollectionId = folders?.find((f) => f.name === DEFAULT_FOLDER)?.id; diff --git a/src/frontend/src/types/zustand/folders/index.ts b/src/frontend/src/types/zustand/folders/index.ts index 2c5b2b96b..5e41677b2 100644 --- a/src/frontend/src/types/zustand/folders/index.ts +++ b/src/frontend/src/types/zustand/folders/index.ts @@ -8,8 +8,6 @@ export type FoldersStoreType = { setLoading: (loading: boolean) => void; selectedFolder: FolderType | null; getFolderById: (id: string) => void; - loadingById: boolean; - setLoadingById: (loading: boolean) => void; getMyCollectionFolder: () => void; myCollectionFlows: FolderType | null; myCollectionId: string | null;