Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lanzhenw committed Nov 24, 2024
1 parent b59d3ef commit 14bcfcd
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function TreeSelectionView(props: ViewPropsType) {
const initialCollapsedState: CollapsedState = React.useMemo(() => {
const state: CollapsedState = {};
structure.forEach(([parentId]) => {
state[parentId] = true; // start as expanded
state[parentId] = true; // start as folded
});
return state;
}, [structure]);
Expand All @@ -92,7 +92,7 @@ export default function TreeSelectionView(props: ViewPropsType) {
});
return newState;
});
setAllCollapsed(!allCollapsed); // Toggle the expand/collapse state
setAllCollapsed(!allCollapsed);
};

const handleCheckboxChange = (id: string, isChecked: boolean) => {
Expand Down Expand Up @@ -178,7 +178,7 @@ export default function TreeSelectionView(props: ViewPropsType) {
const isSample =
!structure.some(([parentId]) => parentId === key) &&
key !== "selectAll";
return isSample && updatedState[key].checked; // Only checked samples
return isSample && updatedState[key].checked;
});

// We update the actual output value (ctx.params.value \ data) here.
Expand All @@ -188,7 +188,6 @@ export default function TreeSelectionView(props: ViewPropsType) {
});
};

// Function to handle expand/collapse toggle
const handleToggleCollapse = (id: string) => {
setCollapsedState((prevState) => ({
...prevState,
Expand Down

0 comments on commit 14bcfcd

Please sign in to comment.