4.8.11 test (#2843)

* feat: app version test

* update doc

* fix: paging num error

* fix: doc api domain

* rename variable

* perf: memment node min size
This commit is contained in:
Archer
2024-09-30 17:28:03 +08:00
committed by GitHub
parent 7c829febec
commit 7c38d1da9a
39 changed files with 427 additions and 179 deletions

View File

@@ -50,12 +50,12 @@ export function usePagination<ResT = any>({
const [isLoading, { setTrue, setFalse }] = useBoolean(false);
const [pageNum, setPageNum] = useState(1);
const [total, setTotal] = useState(0);
const [data, setData] = useState<ResT[]>([]);
const totalDataLength = useMemo(() => Math.max(total, data.length), [total, data.length]);
const isEmpty = total === 0 && !isLoading;
const pageNum = useMemo(() => Math.ceil(data.length / pageSize), [data.length, pageSize]);
const noMore = data.length >= totalDataLength;
const fetchData = useLockFn(
@@ -71,6 +71,7 @@ export function usePagination<ResT = any>({
});
// Check total and set
setPageNum(num);
res.total !== undefined && setTotal(res.total);
if (type === 'scroll') {