@rolster/react-components 18.15.10 → 18.15.12

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/dist/cjs/index.js CHANGED
@@ -2075,8 +2075,6 @@ function useListControl({ suggestions, formControl }) {
2075
2075
  });
2076
2076
  const collection = require$$0.useRef(new components.ListCollection([]));
2077
2077
  const position = require$$0.useRef(0);
2078
- const initializedState = require$$0.useRef(false);
2079
- const initializedCollection = require$$0.useRef(false);
2080
2078
  const changeInternal = require$$0.useRef(false);
2081
2079
  const protectedValue = require$$0.useRef();
2082
2080
  require$$0.useEffect(() => {
@@ -2097,24 +2095,13 @@ function useListControl({ suggestions, formControl }) {
2097
2095
  }));
2098
2096
  }, [state.visible]);
2099
2097
  require$$0.useEffect(() => {
2100
- if (!initializedState.current || !initializedCollection.current) {
2101
- initializedState.current = true;
2102
- return;
2103
- }
2104
2098
  if (changeInternal.current) {
2105
2099
  changeInternal.current = false;
2106
2100
  return;
2107
2101
  }
2108
- refresh(collection.current, formControl?.value);
2109
- }, [formControl?.value]);
2110
- require$$0.useEffect(() => {
2111
2102
  collection.current = new components.ListCollection(suggestions);
2112
- if (!initializedCollection.current || !initializedState.current) {
2113
- initializedCollection.current = true;
2114
- return;
2115
- }
2116
2103
  refresh(collection.current, formControl?.value);
2117
- }, [suggestions]);
2104
+ }, [suggestions, formControl?.value]);
2118
2105
  function refresh(collection, state) {
2119
2106
  if (!state) {
2120
2107
  return refreshProtected(collection) ? undefined : setValue('');
@@ -2162,7 +2149,7 @@ function useListControl({ suggestions, formControl }) {
2162
2149
  event: event,
2163
2150
  list: listRef.current
2164
2151
  });
2165
- position.current = newPosition || 0;
2152
+ position.current = newPosition ?? 0;
2166
2153
  }
2167
2154
  }
2168
2155
  function navigationElement(event) {