Skip to content

Commit

Permalink
#486 Sessions don't restore, whether logged in or anonymous - authent…
Browse files Browse the repository at this point in the history
…ication issue?
  • Loading branch information
Adriána Kohanová committed Jan 26, 2021
1 parent 41957fe commit 44fdd42
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions js/reducers/tracking/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1916,9 +1916,7 @@ const handleChangeRepresentationAction = (action, isAdd, nglView) => (dispatch,
const changeMolecularRepresentation = (action, representation, type, parentKey, nglView) => (dispatch, getState) => {
const newRepresentationType = type;

//const newRepresentationType = e.target.value;
const oldRepresentation = JSON.parse(JSON.stringify(representation));
//const nglView = getNglView(objectsInView[parentKey].display_div);
const comp = nglView.stage.getComponentsByName(parentKey).first;

// add representation to NGL
Expand Down Expand Up @@ -2112,18 +2110,18 @@ export const manageSendTrackingActions = (projectID, copy) => (dispatch, getStat
}
};

export const checkSendTrackingActions = (save = false) => (dispatch, getState) => {
export const checkSendTrackingActions = (save = false) => async (dispatch, getState) => {
const state = getState();
const currentProject = state.projectReducers.currentProject;
const sendActions = state.trackingReducers.send_actions_list;
const length = sendActions.length;

if (length >= CONSTANTS.COUNT_SEND_TRACK_ACTIONS || save) {
dispatch(sendTrackingActions(sendActions, currentProject));
await dispatch(sendTrackingActions(sendActions, currentProject, true));
}
};

const sendTrackingActions = (sendActions, project, clear = true) => async (dispatch, getState) => {
const sendTrackingActions = (sendActions, project, clear = false) => async (dispatch, getState) => {
if (project) {
const projectID = project && project.projectID;

Expand Down Expand Up @@ -2170,6 +2168,8 @@ export const setProjectTrackingActions = () => (dispatch, getState) => {

const getTrackingActions = (projectID, withTreeSeparation) => (dispatch, getState) => {
const state = getState();
const currentProject = state.projectReducers.currentProject;
const currentProjectID = currentProject && currentProject.projectID;
const sendActions = state.trackingReducers.send_actions_list;

if (projectID) {
Expand Down Expand Up @@ -2199,7 +2199,7 @@ const getTrackingActions = (projectID, withTreeSeparation) => (dispatch, getStat
}
}

let projectActions = [...listToSet, ...sendActions];
let projectActions = currentProjectID && currentProjectID != null ? [...listToSet, ...sendActions] : listToSet;
dispatch(setProjectActionList(projectActions));
return Promise.resolve(projectActions);
})
Expand Down Expand Up @@ -2261,7 +2261,7 @@ const checkActionsProject = projectID => async (dispatch, getState) => {
);
};

const copyActionsToProject = (toProject, setActionList = true, clearSendList = true) => async (dispatch, getState) => {
const copyActionsToProject = (toProject, setActionList = true, clear = false) => async (dispatch, getState) => {
const state = getState();
const actionList = state.trackingReducers.project_actions_list;

Expand All @@ -2275,7 +2275,7 @@ const copyActionsToProject = (toProject, setActionList = true, clearSendList = t
if (setActionList === true) {
dispatch(setActionsList(newActionsList));
}
await dispatch(sendTrackingActions(newActionsList, toProject, clearSendList));
await dispatch(sendTrackingActions(newActionsList, toProject, clear));
}
};

Expand Down

0 comments on commit 44fdd42

Please sign in to comment.