Skip to content

Commit

Permalink
Remove node modal on filter removal
Browse files Browse the repository at this point in the history
Clicking a tip brings up a modal and activates the corresponding strain
filter. Inactivating or removing this filter now also clears the modal.

Closes #1243
  • Loading branch information
jameshadfield committed Feb 5, 2024
1 parent f88a368 commit 9790c56
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/reducers/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,20 @@ const Controls = (state: ControlsState = getDefaultControlsState(), action): Con
} else { // remove if no active+inactive filters
delete filters[action.trait]
}

/* In the situation where a node-selected modal is active + we have
removed or inactivated the corresponding filter, then we want to remove
the modal */
let selectedNode = state.selectedNode
if (selectedNode) {
const filterInfo = filters?.[strainSymbol]?.find((f)=>f.value===selectedNode.name);
if (!filterInfo || !filterInfo.active) {
selectedNode = null;
}
}
return Object.assign({}, state, {
filters
filters,
selectedNode,
});
}
case types.TOGGLE_TEMPORAL_CONF:
Expand Down

0 comments on commit 9790c56

Please sign in to comment.