19302: side panel updates favorites Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa...
authorLisa Knox <lisaknox83@gmail.com>
Tue, 24 Oct 2023 19:45:12 +0000 (15:45 -0400)
committerLisa Knox <lisaknox83@gmail.com>
Tue, 24 Oct 2023 19:45:12 +0000 (15:45 -0400)
src/store/favorites/favorites-actions.ts
src/store/side-panel-tree/side-panel-tree-actions.ts

index bd4d878ed59d95556033b36a1a144082268c6d97..8697e68666b1c8e52139febaf75bbb7d205392cc 100644 (file)
@@ -10,6 +10,7 @@ import { checkFavorite } from "./favorites-reducer";
 import { snackbarActions, SnackbarKind } from "../snackbar/snackbar-actions";
 import { ServiceRepository } from "services/services";
 import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
+import { loadFavorites} from "store/side-panel-tree/side-panel-tree-actions";
 
 export const favoritesActions = unionize({
     TOGGLE_FAVORITE: ofType<{ resourceUuid: string }>(),
@@ -51,6 +52,7 @@ export const toggleFavorite = (resource: { uuid: string; name: string }) =>
                     kind: SnackbarKind.SUCCESS
                 }));
                 dispatch(progressIndicatorActions.STOP_WORKING("toggleFavorite"));
+                dispatch<any>(loadFavorites())
             })
             .catch((e: any) => {
                 dispatch(progressIndicatorActions.STOP_WORKING("toggleFavorite"));
index 8fac7dc22b90d870402623fcefaa8ca0ff1daf62..1105285fea98aa4109e45ab9b1b7115c06529950 100644 (file)
@@ -98,7 +98,7 @@ export const loadSidePanelTreeProjects = (projectUuid: string) =>
         if (projectUuid === SidePanelTreeCategory.PUBLIC_FAVORITES) {
             await dispatch<any>(loadPublicFavorites);
         } else if (projectUuid === SidePanelTreeCategory.FAVORITES) {
-            await dispatch<any>(loadFavorites);
+            await dispatch<any>(loadFavorites());
         } else if (node || projectUuid !== '') {
             await dispatch<any>(loadProject(projectUuid));
         }
@@ -124,7 +124,7 @@ const loadProject = (projectUuid: string) =>
         dispatch(resourcesActions.SET_RESOURCES(items));
     };
 
-const loadFavorites = async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const loadFavorites =()=> async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
     dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: SidePanelTreeCategory.FAVORITES, pickerId: SIDE_PANEL_TREE }));
 
     const params = {
@@ -170,7 +170,6 @@ const loadPublicFavorites = async (dispatch: Dispatch, getState: () => RootState
     };
 
     const { items } = await services.linkService.list(params);
-    console.log(items)
 
     dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
         id: SidePanelTreeCategory.PUBLIC_FAVORITES,
@@ -184,7 +183,6 @@ const loadPublicFavorites = async (dispatch: Dispatch, getState: () => RootState
 export const activateSidePanelTreeItem = (id: string) =>
     async (dispatch: Dispatch, getState: () => RootState) => {
         const node = getSidePanelTreeNode(id)(getState().treePicker);
-        console.log(id)
         if (node && !node.active) {
             dispatch(treePickerActions.ACTIVATE_TREE_PICKER_NODE({ id, pickerId: SIDE_PANEL_TREE }));
         }