reset all cells on graph reset

This commit is contained in:
bkmartinjr
2018-05-29 21:40:51 -07:00
parent 9c2870e995
commit bf6ebd5741
2 changed files with 13 additions and 3 deletions

View File

@@ -1,9 +1,11 @@
// jshint esversion: 6
const Cells = (
state = {
cells: null,
cells: null /* world */,
loading: null,
error: null
error: null,
allCells: null /* this comes from cells endpoint, this is universe */
},
action
) => {
@@ -17,13 +19,20 @@ const Cells = (
return Object.assign({}, state, {
error: null,
loading: false,
cells: action.data
cells: action.data, // most recently loaded cells
/* Universe - initialize once */
allCells: state.allCells ? state.allCells : action.data
});
case "request cells error":
return Object.assign({}, state, {
loading: false,
error: action.data
});
case "reset graph":
return Object.assign({}, state, {
cells: state.allCells
});
default:
return state;
}

View File

@@ -103,6 +103,7 @@ const Controls = (
allGeneNames: null,
allCells: null /* this comes from cells endpoint, this is universe */,
allCellsMetadata: null /* this comes from cells endpoint, and is just the metadata for universe */,
allCellsMetadataMap: null,
/* View / World - all cells currently being displayed. May be a subset of Universe. */
cellsMetadata: null,