Skip to content

Commit

Permalink
Make it so we don't try to update simulationIndex or canonicalizeURL …
Browse files Browse the repository at this point in the history
…until data fully loaded. Still broken for loading a second config, but should be getting more sane. Part of #10.
  • Loading branch information
jkomoros committed Dec 11, 2021
1 parent cb9989e commit 5314257
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/actions/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
selectPage,
selectPageExtra,
selectCurrentSimulationName,
selectFilename
selectFilename,
selectDataIsFullyLoaded
} from '../selectors.js';

//if silent is true, then just passively updates the URL to reflect what it should be.
Expand All @@ -21,7 +22,11 @@ export const navigatePathTo = (path, silent) => (dispatch) => {
};

export const canonicalizePath = () => (dispatch ,getState) => {

const state = getState();

//We don't have the necessary information to canonicalize until we have all data loaded
if (!selectDataIsFullyLoaded(state)) return;
const page = selectPage(state);
const pageExtra = selectPageExtra(state);

Expand Down
5 changes: 3 additions & 2 deletions src/actions/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ import {
selectDelayCount,
selectLoadedSimulators,
selectRawConfigData,
selectScale
selectScale,
selectDataIsFullyLoaded
} from '../selectors.js';

import {
Expand Down Expand Up @@ -156,7 +157,7 @@ export const updateWithSimPageExtra = (pageExtra) => (dispatch, getState) => {

//Each of these will return if a no op
dispatch(updateFilename(filename, true));
dispatch(updateSimulationIndex(simulationIndex, true));
if (selectDataIsFullyLoaded(getState())) dispatch(updateSimulationIndex(simulationIndex, true));
};

export const resetSimulation = () => (dispatch) => {
Expand Down

0 comments on commit 5314257

Please sign in to comment.