@agility/plenum-ui 2.1.18 → 2.1.19-rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -49,10 +49,16 @@ const Select: React.FC<ISelectProps> = ({
|
|
|
49
49
|
if (!name) name = id;
|
|
50
50
|
|
|
51
51
|
useEffect(() => {
|
|
52
|
+
// handle the case where value could be "" or false
|
|
53
|
+
if (value === "") {
|
|
54
|
+
const matchedOption = options.find((option) => option.value === "");
|
|
55
|
+
setSelectedOption(matchedOption?.value || options[0].value);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
52
58
|
if (value !== undefined && value !== null) {
|
|
53
59
|
setSelectedOption(value);
|
|
54
60
|
}
|
|
55
|
-
}, [value]);
|
|
61
|
+
}, [options, value]);
|
|
56
62
|
|
|
57
63
|
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
58
64
|
const targetValue = e.target.value;
|