Skip to content

Commit

Permalink
fix undefined error
Browse files Browse the repository at this point in the history
  • Loading branch information
asizemore committed Dec 5, 2024
1 parent 8728469 commit 721751b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function SelectTree<T>(props: SelectTreeProps<T>) {
// live updates to caller when needed
useEffect(() => {
if (!instantUpdate) return;
if (!onSelectionChange) return;
onSelectionChange(localSelectedList);
}, [onSelectionChange, localSelectedList, instantUpdate]);

Expand All @@ -74,7 +75,8 @@ function SelectTree<T>(props: SelectTreeProps<T>) {
? truncatedButtonContent(localSelectedList)
: props.buttonDisplayContent
);
if (!instantUpdate) onSelectionChange(localSelectedList);
if (!instantUpdate && onSelectionChange)
onSelectionChange(localSelectedList);
};

const checkboxTree = (
Expand Down

0 comments on commit 721751b

Please sign in to comment.