Skip to content

Commit

Permalink
fix(client): reset more state on dataset switch
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jan 18, 2024
1 parent 45e1057 commit 6e835ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions client/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export default function Header({children, onAbout, /*onDatasets, */onDatasetAbou
console.debug("Datasets by node:", datasetsByNode);

const isLoadingData = useSelector((state) =>
state.assays.isLoading ||
state.samples.isLoading ||
state.peaks.isLoading ||
state.positions.isLoading ||
state.overview.isLoading ||
state.user.isLoading);
Expand Down
13 changes: 7 additions & 6 deletions client/src/helpers/reducers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as k from "../constants/ActionTypes"

export const makeDefaultListState = (defaultList = undefined) => ({
isLoading: false,
isLoaded: false,
Expand All @@ -12,13 +14,12 @@ export const makeListReducer = (types, defaultState) => (state = defaultState, a
return {...state, isLoading: false, isLoaded: true, list: action.payload};
case types.ERROR:
return {...state, isLoading: false};

// TODO: this can create a race condition with fetching
case k.SET_NODE:
return defaultState;

default:
return state;
}
};

export const makeDefaultDataState = (defaultData = undefined) => ({
isLoading: false,
isLoaded: false,
data: defaultData,
});

0 comments on commit 6e835ca

Please sign in to comment.