@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
- // Only update the fieldset when options change, when options is an array.
209
- // Otherwise, if the options are passed in as an object, then we assume the caller is updating options via a Promise and not via updating props.
210
- if (Array.isArray(maybeOptions) && maybeOptions !== fieldState.allOptions) {
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 = maybeOptions.filter((o) => values === null || values === void 0 ? void 0 : values.includes(getOptionValue(o)));
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: maybeOptions,
224
- allOptions: maybeOptions,
229
+ filteredOptions: maybeUpdatedOptions,
230
+ allOptions: maybeUpdatedOptions,
225
231
  };
226
232
  });
227
233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.272.1",
3
+ "version": "2.272.2",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",