mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
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:
@@ -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') {
|
||||
|
Reference in New Issue
Block a user