lu-lowcode-package-form 0.10.60 → 0.10.61

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.10.60",
3
+ "version": "0.10.61",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -12,7 +12,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
12
12
 
13
13
  const currentPageRef = useRef(1);
14
14
  const currentPageSize = 10
15
- const [isAllLoaded, setIsAllLoaded] = useState(false)
15
+ const isAllLoadedRef = useRef(false)
16
16
  useEffect(() => {
17
17
  // console.log("SearchSelect useEffect props", props)
18
18
  if (value) {
@@ -79,6 +79,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
79
79
  let item = null
80
80
  const ruleParams = {}
81
81
  currentPageRef.current = 1
82
+ isAllLoadedRef.current = false
82
83
  if (request && typeof request === 'function') {
83
84
  debounceFetchOptions(params, ruleParams)
84
85
  }
@@ -192,13 +193,16 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
192
193
  };
193
194
 
194
195
  const loadMoreOptions = async () => {
196
+ if (isAllLoadedRef.current) return
195
197
  const nextPageParams = { ...requestParams, page: currentPageRef.current + 1, pageSize: currentPageSize };
196
198
  let newOptions = await fetchList(nextPageParams, null)
197
199
  newOptions = await handleOptions(newOptions)
198
200
  if (Array.isArray(newOptions) && newOptions.length > 0) {
199
201
  setNOptions(prevOptions => [...prevOptions, ...newOptions]);
200
- currentPageRef.current = currentPageRef.current + 1;
202
+ } else {
203
+ isAllLoadedRef.current = true
201
204
  }
205
+ currentPageRef.current = currentPageRef.current + 1;
202
206
  };
203
207
  return addWrapper ? (
204
208
  <BaseWrapper {...props}>