mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-25 06:08:12 +08:00
Undo feature: fix case where previous state has no state filter (#1124)
* Undo feature: fix case where previous state has no state filter Fixes https://github.com/chanzuckerberg/cellxgene/issues/1099 When the previous state that the undo feature is trying to roll back to has no filter state, merging javascript dictionaries result in keeping the current state filter, preventing the actionFilter from saving the new state. * Fix whitespace
This commit is contained in:
@@ -85,6 +85,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
|
||||
);
|
||||
const newPast = [...past];
|
||||
const newState = newPast.pop();
|
||||
const newStateFilterState = newState[filterStateKey];
|
||||
const newFuture = push(future, currentUndoableState);
|
||||
const nextState = {
|
||||
...currentState,
|
||||
@@ -93,6 +94,7 @@ const Undoable = (reducer, undoableKeys, options = {}) => {
|
||||
[futureKey]: newFuture,
|
||||
[pendingKey]: null
|
||||
};
|
||||
nextState[filterStateKey] = newStateFilterState;
|
||||
return nextState;
|
||||
}
|
||||
|
||||
|
||||
@@ -170,6 +170,8 @@ const actionFilter = debug => (state, action, prevFilterState) => {
|
||||
}
|
||||
if (
|
||||
debounceOnActions.has(actionType) &&
|
||||
prevFilterState !== undefined &&
|
||||
prevFilterState.prevAction !== undefined &&
|
||||
shallowObjectEq(action, prevFilterState.prevAction)
|
||||
) {
|
||||
return { [actionKey]: "skip", [stateKey]: filterState };
|
||||
|
||||
Reference in New Issue
Block a user