Skip to content

Commit

Permalink
xchem#11 add fix of infinity loop during creating initial snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
tibor-postek-m2ms committed Apr 16, 2020
1 parent 8079dae commit e7eea25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions js/components/preview/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ export const shouldLoadProtein = ({
isStateLoaded,
routeProjectID,
routeSnapshotID,
currentSnapshotID
currentSnapshotID,
isLoadingCurrentSnapshot
}) => (dispatch, getState) => {
const state = getState();
const targetIdList = state.apiReducers.target_id_list;
const targetOnName = state.apiReducers.target_on_name;
const currentSnapshotData = state.projectReducers.currentSnapshot.data;
const isLoadingCurrentSnapshot = state.projectReducers.isLoadingCurrentSnapshot;
// const isLoadingCurrentSnapshot = state.projectReducers.isLoadingCurrentSnapshot;
if (
targetIdList &&
targetIdList.length > 0 &&
Expand Down
14 changes: 12 additions & 2 deletions js/components/preview/withLoadingProtein.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const withLoadingProtein = WrappedComponent => {
const routeProjectID = match && match.params && match.params.projectId;
const routeSnapshotID = match && match.params && match.params.snapshotId;
const currentSnapshotID = useSelector(state => state.projectReducers.currentSnapshot.id);
const isLoadingCurrentSnapshot = useSelector(state => state.projectReducers.isLoadingCurrentSnapshot);

useEffect(() => {
dispatch(
Expand All @@ -24,10 +25,19 @@ export const withLoadingProtein = WrappedComponent => {
isStateLoaded,
routeProjectID,
routeSnapshotID,
currentSnapshotID
currentSnapshotID,
isLoadingCurrentSnapshot
})
);
}, [dispatch, isStateLoaded, nglViewList, routeProjectID, routeSnapshotID, currentSnapshotID]);
}, [
dispatch,
isStateLoaded,
nglViewList,
routeProjectID,
routeSnapshotID,
currentSnapshotID,
isLoadingCurrentSnapshot
]);

return <WrappedComponent isStateLoaded={isStateLoaded} {...rest} />;
});
Expand Down

0 comments on commit e7eea25

Please sign in to comment.