@homebound/beam 2.272.1 → 2.272.2
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.
|
@@ -205,12 +205,18 @@ function ComboBoxBase(props) {
|
|
|
205
205
|
}
|
|
206
206
|
}, [values]);
|
|
207
207
|
(0, react_1.useEffect)(() => {
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
|
|
208
|
+
// When options are an array, then use them as-is.
|
|
209
|
+
// If options are an object, then use the `initial` array if the menu has not been opened
|
|
210
|
+
// Otherwise, use the current fieldState array options.
|
|
211
|
+
const maybeUpdatedOptions = Array.isArray(maybeOptions)
|
|
212
|
+
? maybeOptions
|
|
213
|
+
: firstOpen.current === false
|
|
214
|
+
? fieldState.allOptions
|
|
215
|
+
: maybeOptions.initial;
|
|
216
|
+
if (maybeUpdatedOptions !== fieldState.allOptions) {
|
|
211
217
|
setFieldState((prevState) => {
|
|
212
218
|
var _a;
|
|
213
|
-
const selectedOptions =
|
|
219
|
+
const selectedOptions = maybeUpdatedOptions.filter((o) => values === null || values === void 0 ? void 0 : values.includes(getOptionValue(o)));
|
|
214
220
|
return {
|
|
215
221
|
...prevState,
|
|
216
222
|
selectedKeys: (_a = selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.map((o) => (0, Value_1.valueToKey)(getOptionValue(o)))) !== null && _a !== void 0 ? _a : [],
|
|
@@ -220,8 +226,8 @@ function ComboBoxBase(props) {
|
|
|
220
226
|
? nothingSelectedText
|
|
221
227
|
: "",
|
|
222
228
|
selectedOptions: selectedOptions,
|
|
223
|
-
filteredOptions:
|
|
224
|
-
allOptions:
|
|
229
|
+
filteredOptions: maybeUpdatedOptions,
|
|
230
|
+
allOptions: maybeUpdatedOptions,
|
|
225
231
|
};
|
|
226
232
|
});
|
|
227
233
|
}
|