fix: missing pageSize parameters when setting column field sorting (#4219)

* fix: missing pageSize parameters when setting column field sorting

* fix: missing pageSize parameters when setting column field sorting
This commit is contained in:
katherinehhh 2024-04-29 13:16:33 +08:00 committed by GitHub
parent f366c39fda
commit 964d631c1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,6 +16,7 @@ export const useTableBlockProps = () => {
const { getDataBlocks } = useFilterBlock(); const { getDataBlocks } = useFilterBlock();
const isLoading = ctx?.service?.loading; const isLoading = ctx?.service?.loading;
const params = useMemo(() => ctx?.service?.params, [JSON.stringify(ctx?.service?.params)]); const params = useMemo(() => ctx?.service?.params, [JSON.stringify(ctx?.service?.params)]);
useEffect(() => { useEffect(() => {
if (!isLoading) { if (!isLoading) {
const serviceResponse = ctx?.service?.data; const serviceResponse = ctx?.service?.data;
@ -74,7 +75,8 @@ export const useTableBlockProps = () => {
: [`-${sorter.field}`] : [`-${sorter.field}`]
: globalSort || ctx.dragSortBy : globalSort || ctx.dragSortBy
: ctx.dragSortBy; : ctx.dragSortBy;
ctx.service.run({ ...params?.[0], page: current, pageSize, sort }); const currentPageSize = pageSize || fieldSchema.parent?.['x-decorator-props']?.['params']?.pageSize;
ctx.service.run({ ...params?.[0], page: current || 1, pageSize: currentPageSize, sort });
}, },
[globalSort, params], [globalSort, params],
), ),