X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/b6ac7fe88d347582d39fffa002e300af222c578f..394ebdfd13fe40a7096f484c46a353d2537f4c9a:/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 813fe446..ee476524 100644 --- a/src/store/collection-panel/collection-panel-action.ts +++ b/src/store/collection-panel/collection-panel-action.ts @@ -4,7 +4,6 @@ import { Dispatch } from "redux"; import { - loadCollectionFiles, COLLECTION_PANEL_LOAD_FILES_THRESHOLD } from "./collection-panel-files/collection-panel-files-actions"; import { CollectionResource } from 'models/collection'; @@ -18,6 +17,7 @@ import { SnackbarKind } from 'store/snackbar/snackbar-actions'; import { navigateTo } from 'store/navigation/navigation-action'; import { loadDetailsPanel } from 'store/details-panel/details-panel-action'; import { addProperty, deleteProperty } from "lib/resource-properties"; +import { getResource } from "store/resources/resources"; export const collectionPanelActions = unionize({ SET_COLLECTION: ofType(), @@ -40,7 +40,6 @@ export const loadCollectionPanel = (uuid: string, forceReload = false) => dispatch(resourcesActions.SET_RESOURCES([collection])); if (collection.fileCount <= COLLECTION_PANEL_LOAD_FILES_THRESHOLD && !getState().collectionPanel.loadBigCollections) { - dispatch(loadCollectionFiles(collection.uuid)); } return collection; }; @@ -53,11 +52,13 @@ export const createCollectionTag = (data: TagProperty) => const properties = Object.assign({}, item.properties); const key = data.keyID || data.key; const value = data.valueID || data.value; + const cachedCollection = getResource(item.uuid)(getState().resources); services.collectionService.update( item.uuid, { properties: addProperty(properties, key, value) } ).then(updatedCollection => { + updatedCollection = {...cachedCollection, ...updatedCollection}; dispatch(collectionPanelActions.SET_COLLECTION(updatedCollection)); dispatch(resourcesActions.SET_RESOURCES([updatedCollection])); dispatch(snackbarActions.OPEN_SNACKBAR({ @@ -90,11 +91,13 @@ export const deleteCollectionTag = (key: string, value: string) => if (!item) { return; } const properties = Object.assign({}, item.properties); + const cachedCollection = getResource(item.uuid)(getState().resources); services.collectionService.update( item.uuid, { properties: deleteProperty(properties, key, value) } ).then(updatedCollection => { + updatedCollection = {...cachedCollection, ...updatedCollection}; dispatch(collectionPanelActions.SET_COLLECTION(updatedCollection)); dispatch(resourcesActions.SET_RESOURCES([updatedCollection])); dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Tag has been successfully deleted.", hideDuration: 2000, kind: SnackbarKind.SUCCESS }));