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
+12 -3
View File
@@ -1,9 +1,11 @@
// jshint esversion: 6 // jshint esversion: 6
const Cells = ( const Cells = (
state = { state = {
cells: null, cells: null /* world */,
loading: null, loading: null,
error: null error: null,
allCells: null /* this comes from cells endpoint, this is universe */
}, },
action action
) => { ) => {
@@ -17,13 +19,20 @@ const Cells = (
return Object.assign({}, state, { return Object.assign({}, state, {
error: null, error: null,
loading: false, 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": case "request cells error":
return Object.assign({}, state, { return Object.assign({}, state, {
loading: false, loading: false,
error: action.data error: action.data
}); });
case "reset graph":
return Object.assign({}, state, {
cells: state.allCells
});
default: default:
return state; return state;
} }
+1
View File
@@ -103,6 +103,7 @@ const Controls = (
allGeneNames: null, allGeneNames: null,
allCells: null /* this comes from cells endpoint, this is universe */, allCells: null /* this comes from cells endpoint, this is universe */,
allCellsMetadata: null /* this comes from cells endpoint, and is just the metadata for 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. */ /* View / World - all cells currently being displayed. May be a subset of Universe. */
cellsMetadata: null, cellsMetadata: null,