-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(useAntdTable): 重置后 filter 和 sorter 参数丢失的问题 #2486
Conversation
@guaijie 试了下没复现出来这个 PR 要解决的问题,麻烦来个在线 demo 看看? |
This comment was marked as outdated.
This comment was marked as outdated.
@guaijie 我复现了,不用改 codesandbox 权限了 |
@hchlq 程哥,这个得你来看看了,我不清楚这块之前咋设计的。 目前的行为: 这个 PR 修改后的行为: 所以,reset 的时候,需要重置 filters, sorter, extra 吗? |
龙哥之前是这么设计的,也不太确定之前的上下文,不过 reset 的定义本身就是重置表单,这么改可能有 breakchange。 另外不改会有什么问题? |
@guaijie 对于你提的问题,重置之后当下的代码不是重置 defaultParams[0] 了吗,不是包含了 sorter,filter 相关字段了吗 _submit({
...(defaultParams?.[0] || {}),
pageSize: options.defaultPageSize || options.defaultParams?.[0]?.pageSize || 10,
current: 1,
}); defaultParams[0] 即为分页数据
|
既然这样,是不是不应该重置 table 的参数比如 sorter。目前 reset 会把 table 筛选带的参数重置掉,也就是影响到 table 主体了。 |
但是我仔细看了下文档,应该是文档写的不是特别严谨,是要重置 Table 相关数据的 |
当下的表现是重置 defaultParams[0] 和 pageSize 相关数据,因为没有传入 sorter 和 filter 相关信息,因此不会重置,符合当时设计的预期。 |
如果要改的话,应该是增加 sorter 或者 filter 的默认值,但是感觉不是很有必要捏 |
@hchlq 明白了程哥,你说的没错。 那你再看下这个行为:
是不是有点问题~ |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self Check before Merge