From b72493b08aa442ba8926f17ef972a1cc09b52d11 Mon Sep 17 00:00:00 2001 From: Tibor Postek Date: Thu, 16 Apr 2020 06:57:32 +0200 Subject: [PATCH] #255 enable to make interaction after switching of snapshots in project --- js/components/helpers/useEnableUserInteracion.js | 3 ++- js/components/preview/redux/dispatchActions.js | 6 +++++- js/components/snapshot/redux/dispatchActions.js | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/js/components/helpers/useEnableUserInteracion.js b/js/components/helpers/useEnableUserInteracion.js index 64ce92aea..afead7509 100644 --- a/js/components/helpers/useEnableUserInteracion.js +++ b/js/components/helpers/useEnableUserInteracion.js @@ -21,7 +21,8 @@ export const useDisableUserInteraction = () => { countOfPendingNglObjects[VIEWS.SUMMARY_VIEW] === 0 && countOfPendingNglObjects[VIEWS.MAJOR_VIEW] === 0 && ((countOfRemainingMoleculeGroups === 0 && proteinsHasLoaded === true) || - (countOfRemainingMoleculeGroups === null && proteinsHasLoaded === null)) + (countOfRemainingMoleculeGroups === null && proteinsHasLoaded === null) || + (countOfRemainingMoleculeGroups === null && proteinsHasLoaded === true)) ) { if (disableInteraction === true) { setDisableInteraction(false); diff --git a/js/components/preview/redux/dispatchActions.js b/js/components/preview/redux/dispatchActions.js index 35d4de5fc..4fbe7d80b 100644 --- a/js/components/preview/redux/dispatchActions.js +++ b/js/components/preview/redux/dispatchActions.js @@ -69,7 +69,11 @@ export const shouldLoadProtein = ({ } // decide to load existing snapshot - else if (currentSnapshotID !== null && currentSnapshotData !== null) { + else if ( + currentSnapshotID !== null && + (!routeSnapshotID || routeSnapshotID === currentSnapshotID.toString()) && + currentSnapshotData !== null + ) { dispatch(reloadSession(currentSnapshotData, nglViewList)); } diff --git a/js/components/snapshot/redux/dispatchActions.js b/js/components/snapshot/redux/dispatchActions.js index 5487f87ab..149c2d554 100644 --- a/js/components/snapshot/redux/dispatchActions.js +++ b/js/components/snapshot/redux/dispatchActions.js @@ -29,8 +29,8 @@ export const reloadSession = (snapshotData, nglViewList) => (dispatch, getState) if (nglViewList.length > 0) { dispatch(reloadSelectionReducer(snapshotData.selectionReducers)); - nglViewList.forEach(async nglView => { - await dispatch(reloadNglViewFromSnapshot(nglView.stage, nglView.id, snapshotData.nglReducers)); + nglViewList.forEach(nglView => { + dispatch(reloadNglViewFromSnapshot(nglView.stage, nglView.id, snapshotData.nglReducers)); }); if (snapshotData.selectionReducers.vectorOnList.length !== 0) {