X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/614e5664c62ac01307744e29072ca1804cb7e676..5430c336b96cbb7c20bffa1cbdb8cffea32fb460:/src/store/collection-panel/collection-panel-action.ts diff --git a/src/store/collection-panel/collection-panel-action.ts b/src/store/collection-panel/collection-panel-action.ts index 55eb5949..7bab8632 100644 --- a/src/store/collection-panel/collection-panel-action.ts +++ b/src/store/collection-panel/collection-panel-action.ts @@ -15,7 +15,6 @@ import { loadDetailsPanel } from 'store/details-panel/details-panel-action'; export const collectionPanelActions = unionize({ SET_COLLECTION: ofType(), - LOAD_COLLECTION_SUCCESS: ofType<{ item: CollectionResource }>(), }); export type CollectionPanelAction = UnionOf; @@ -23,12 +22,15 @@ export type CollectionPanelAction = UnionOf; export const loadCollectionPanel = (uuid: string, forceReload = false) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const { collectionPanel: { item } } = getState(); - const collection = (item && item.uuid === uuid && !forceReload) - ? item - : await services.collectionService.get(uuid); + let collection: CollectionResource | null = null; + if (!item || item.uuid !== uuid || forceReload) { + collection = await services.collectionService.get(uuid); + dispatch(collectionPanelActions.SET_COLLECTION(collection)); + dispatch(resourcesActions.SET_RESOURCES([collection])); + } else { + collection = item; + } dispatch(loadDetailsPanel(collection.uuid)); - dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: collection })); - dispatch(resourcesActions.SET_RESOURCES([collection])); return collection; };