Skip to content

Commit 5311ec9

Browse files
committed
update filtered options immediately
1 parent bb1528d commit 5311ec9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/FeatureSelect.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ const FeatureSelect: React.FC<SignupFormMultiSelectProps> = ({
9898
(opt: FeatureInterface) => opt.id !== id,
9999
);
100100
}
101+
// Update filteredOptions immediately
102+
setFilteredOptions(filterOptions(value, updated));
101103
return updated;
102104
});
103105
}
@@ -193,10 +195,13 @@ const FeatureSelect: React.FC<SignupFormMultiSelectProps> = ({
193195
);
194196
if (alreadyIndex !== -1) newGroup.splice(alreadyIndex, 1);
195197
newGroup.splice(insertIndex, 0, option);
196-
setOptions({
198+
const updatedOptions = {
197199
...options,
198200
[groupKey]: newGroup,
199-
});
201+
};
202+
setOptions(updatedOptions);
203+
// Update filteredOptions immediately
204+
setFilteredOptions(filterOptions(value, updatedOptions));
200205
}
201206
}
202207
}

0 commit comments

Comments
 (0)