Skip to content

Commit 84733db

Browse files
feat(NavigationTree): collapse childless nodes (#84)
1 parent 3f62244 commit 84733db

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/NavigationTree/state.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ export function reducer(state: NavigationTreeState = {}, action: NavigationTreeA
123123
}
124124
}
125125

126+
if (!action.payload.data || action.payload.data.length === 0) {
127+
newState[action.payload.path] = {
128+
...newState[action.payload.path],
129+
expandable: false,
130+
collapsed: true,
131+
};
132+
}
133+
126134
return newState;
127135
}
128136
case NavigationTreeActionType.ErrorLoading:

0 commit comments

Comments
 (0)