From 35efb088db42857e6dd7ce502aa1e040fe6876f4 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Thu, 25 Apr 2024 11:34:14 +0100 Subject: [PATCH] prevent unintended case fallthrough in tree view --- .../app/components/primitives/TreeView/reducer.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/webapp/app/components/primitives/TreeView/reducer.ts b/apps/webapp/app/components/primitives/TreeView/reducer.ts index 4a8180d4c..ace31e826 100644 --- a/apps/webapp/app/components/primitives/TreeView/reducer.ts +++ b/apps/webapp/app/components/primitives/TreeView/reducer.ts @@ -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}`);