Commit 4a9c159e authored by Daniel Hochman's avatar Daniel Hochman
Browse files

defensive

No related merge requests found
Showing with 3 additions and 1 deletion
+3 -1
......@@ -205,7 +205,9 @@ const Select = ({
const defaultIdx = defaultOption < optionLength ? defaultOption : 0;
const [selectedIdx, setSelectedIdx] = React.useState(defaultIdx);
React.useEffect(() => {
optionLength > 0 && onChange && onChange(options[selectedIdx]?.value || options[selectedIdx].label);
optionLength > 0 &&
onChange &&
onChange(options[selectedIdx]?.value || options[selectedIdx].label);
}, [options]);
if (optionLength === 0) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment