Skip to content

Commit

Permalink
Merge pull request #120 from umijs/fix/useAntdTable
Browse files Browse the repository at this point in the history
Fix/use antd table
  • Loading branch information
brickspert authored Oct 31, 2019
2 parents bd300d6 + 81c7e77 commit 02a71bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/useAntdTable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,16 @@ function useAntdTable<Result, Item>(
f: Record<keyof Item, string[]> = {} as Record<keyof Item, string[]>,
s: SorterResult<Item> = {} as SorterResult<Item>,
) => {
// antd table 的初始状态 filter 带有 null 字段,需要先去除后再比较
const realFilter = {...f};
Object.entries(realFilter).forEach( item => {
if(item[1] === null) {
delete (realFilter as Object)[item[0] as keyof Object];
}
});
/* 如果 filter,或者 sort 变化,就初始化 current */
const needReload =
!isEqual(f, state.filters) ||
!isEqual(realFilter, state.filters) ||
s.field !== state.sorter.field ||
s.order !== state.sorter.order;
dispatch({
Expand Down

1 comment on commit 02a71bb

@vercel
Copy link

@vercel vercel bot commented on 02a71bb Oct 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.