prevent unintended case fallthrough in tree view

This commit is contained in:
nicktrn
2024-04-25 11:34:14 +01:00
parent 0a6e549e0f
commit 35efb088db
@@ -1,3 +1,4 @@
import assertNever from "assert-never";
import { FlatTree } from "./TreeView";
import {
applyVisibility,
@@ -389,6 +390,8 @@ export function reducer(state: TreeState, action: Action): TreeState {
},
});
}
return state;
}
case "SELECT_LAST_VISIBLE_NODE": {
const node = lastVisibleNode(action.payload.tree, state.nodes);
@@ -402,6 +405,8 @@ export function reducer(state: TreeState, action: Action): TreeState {
},
});
}
return state;
}
case "SELECT_NEXT_VISIBLE_NODE": {
const selected = selectedIdFromState(state.nodes);
@@ -429,6 +434,8 @@ export function reducer(state: TreeState, action: Action): TreeState {
},
});
}
return state;
}
case "SELECT_PREVIOUS_VISIBLE_NODE": {
const selected = selectedIdFromState(state.nodes);
@@ -504,6 +511,9 @@ export function reducer(state: TreeState, action: Action): TreeState {
});
return newState;
}
default: {
assertNever(action);
}
}
throw new Error(`Unhandled action type: ${(action as any).type}`);