Skip to content

Commit

Permalink
fix(table): Fix the issue of actionref not being synchronized
Browse files Browse the repository at this point in the history
close #6500
  • Loading branch information
chenshuai2144 committed Jul 15, 2023
1 parent 84b79c8 commit 2160fb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/layout/src/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type MenuDataItem = {
/** @name disable 菜单选项 */
disabled?: boolean;
/** @name disable menu 的 tooltip 菜单选项 */
disabledTooltip: boolean;
disabledTooltip?: boolean;
/** @name 路径,可以设定为网页链接 */
path?: string;
/**
Expand Down
6 changes: 5 additions & 1 deletion packages/table/src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,12 @@ const ProTable = <
...action.pageInfo,
setPageInfo: ({ pageSize, current }: PageInfo) => {
const { pageInfo } = action;

// pageSize 发生改变,并且你不是在第一页,切回到第一页
// 这样可以防止出现 跳转到一个空的数据页的问题
if (pageSize === pageInfo.pageSize || pageInfo.current === 1) {
action.setPageInfo({ pageSize, current });

return;
}

Expand Down Expand Up @@ -678,7 +680,6 @@ const ProTable = <
setSelectedRowKeys([]);
}, [propsRowSelection, setSelectedRowKeys]);

counter.setAction(actionRef.current);
counter.propsRef.current = props;

/** 可编辑行的相关配置 */
Expand Down Expand Up @@ -734,6 +735,9 @@ const ProTable = <
editableUtils,
});

/** 同步 action */
counter.setAction(actionRef.current);

if (propsActionRef) {
// @ts-ignore
propsActionRef.current = actionRef.current;
Expand Down

0 comments on commit 2160fb8

Please sign in to comment.