@simplybusiness/mobius 9.1.1 → 9.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 9.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 84b1a01: Add new `<Text>` variant `title`; use for Section/Recommendations/Showcase in mobius-journey
8
+
9
+ ### Patch Changes
10
+
11
+ - c85201e: Fix inifinite API requests from AddressSearch
12
+
13
+ ## 9.1.2
14
+
15
+ ### Patch Changes
16
+
17
+ - 53f86f6: Update dependenies
18
+ - @simplybusiness/icons@5.0.3
19
+ - @simplybusiness/mobius-hooks@0.1.1
20
+
3
21
  ## 9.1.1
4
22
 
5
23
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -1691,6 +1691,10 @@ function useComboboxOptions({
1691
1691
  );
1692
1692
  const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
1693
1693
  const [error3, setError] = (0, import_react12.useState)(null);
1694
+ const asyncOptionsRef = (0, import_react12.useRef)(asyncOptions);
1695
+ asyncOptionsRef.current = asyncOptions;
1696
+ const onSearchedRef = (0, import_react12.useRef)(onSearched);
1697
+ onSearchedRef.current = onSearched;
1694
1698
  (0, import_react12.useEffect)(() => {
1695
1699
  const controller = new AbortController();
1696
1700
  const { signal } = controller;
@@ -1698,14 +1702,16 @@ function useComboboxOptions({
1698
1702
  setIsLoading(true);
1699
1703
  setError(null);
1700
1704
  try {
1701
- if (asyncOptions) {
1705
+ if (asyncOptionsRef.current) {
1702
1706
  if (debouncedInputValue.length < minSearchLength) {
1703
1707
  setFilteredOptions(void 0);
1704
1708
  return;
1705
1709
  }
1706
- const result = await asyncOptions(debouncedInputValue, { signal });
1710
+ const result = await asyncOptionsRef.current(debouncedInputValue, {
1711
+ signal
1712
+ });
1707
1713
  setFilteredOptions(result);
1708
- onSearched?.(debouncedInputValue);
1714
+ onSearchedRef.current?.(debouncedInputValue);
1709
1715
  } else if (options) {
1710
1716
  setFilteredOptions(filterOptions(options, debouncedInputValue));
1711
1717
  } else {
@@ -1731,11 +1737,9 @@ function useComboboxOptions({
1731
1737
  }, [
1732
1738
  debouncedInputValue,
1733
1739
  options,
1734
- asyncOptions,
1735
1740
  delay,
1736
1741
  minSearchLength,
1737
- skipNextDebounceRef,
1738
- onSearched
1742
+ skipNextDebounceRef
1739
1743
  ]);
1740
1744
  function updateFilteredOptions(newOptions) {
1741
1745
  setIsLoading(true);
@@ -1749,13 +1753,13 @@ function useComboboxOptions({
1749
1753
  isError: error3 != null
1750
1754
  };
1751
1755
  }
1752
- var import_react12, import_mobius_hooks4;
1756
+ var import_mobius_hooks4, import_react12;
1753
1757
  var init_useComboboxOptions = __esm({
1754
1758
  "src/components/Combobox/useComboboxOptions.ts"() {
1755
1759
  "use strict";
1760
+ import_mobius_hooks4 = require("@simplybusiness/mobius-hooks");
1756
1761
  import_react12 = require("react");
1757
1762
  init_utils2();
1758
- import_mobius_hooks4 = require("@simplybusiness/mobius-hooks");
1759
1763
  }
1760
1764
  });
1761
1765