Skip to content

Commit 3c0d4b7

Browse files
committed
fix: selected node not cleared when a different node is selected
1 parent 7526301 commit 3c0d4b7

4 files changed

Lines changed: 3 additions & 31 deletions

File tree

src/stores/view/subscriptions/actions/maybe-clear-selection.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/stores/view/subscriptions/on-view-state-update.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
getViewEventType,
55
ViewEventType,
66
} from 'src/stores/view/helpers/get-view-event-type';
7-
import { maybeClearSelection } from 'src/stores/view/subscriptions/actions/maybe-clear-selection';
87
import { updateSearchResults } from 'src/stores/view/subscriptions/actions/update-search-results';
98
import { focusContainer } from 'src/stores/view/subscriptions/effects/focus-container';
109
import { persistActiveNodeInPluginSettings } from 'src/stores/view/subscriptions/actions/persist-active-node-in-plugin-settings';
@@ -49,15 +48,6 @@ export const onViewStateUpdate = (
4948
}
5049
}
5150

52-
if (
53-
activeNodeChange &&
54-
activeNodeHasChanged &&
55-
type !== 'DOCUMENT/NAVIGATE_USING_KEYBOARD' &&
56-
type !== 'DOCUMENT/JUMP_TO_NODE'
57-
) {
58-
maybeClearSelection(view, action);
59-
}
60-
6151
if (action.type === 'SEARCH/SET_QUERY') {
6252
updateSearchResults(view);
6353
}

src/stores/view/view-reducer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const updateDocumentState = (
4141
action.type === 'view/set-active-node/search'
4242
) {
4343
updateActiveNode(state.document, action.payload.id, state);
44+
if (!state.document.selectedNodes.has(state.document.activeNode))
45+
resetSelectionState(state.document);
4446
} else if (action.type === 'DOCUMENT/NAVIGATE_USING_KEYBOARD') {
4547
navigateUsingKeyboard(state.document, state, action, context.columns);
4648
} else if (action.type === 'SEARCH/SET_QUERY') {

src/view/actions/on-escape/helpers/handle-escape-key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const handleEscapeKey = (view: LineageView) => {
3737
type: 'SEARCH/TOGGLE_INPUT',
3838
});
3939
return true;
40-
} else if (selection.size > 1) {
40+
} else if (selection.size > 0) {
4141
viewStore.dispatch({
4242
type: 'DOCUMENT/CLEAR_SELECTION',
4343
});

0 commit comments

Comments
 (0)