Skip to content

Conversation

@huangchen1031
Copy link
Collaborator

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

受控用法下,pagination修改后innerPagination数据未同步,导致序号列计算错误
Clipboard_Screenshot_1742976469

💡 需求背景和解决方案

📝 更新日志

  • fix(组件名称): 处理问题或特性描述 ...

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@huangchen1031 huangchen1031 changed the title fix(table): 受控用法分页数据同步 fix(table): 'serial-number' column calculate error Mar 26, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 26, 2025

Open in Stackblitz

npm i https://pkg.pr.new/tdesign-react@3450

commit: 3ceeca9

@github-actions
Copy link
Contributor

github-actions bot commented Mar 26, 2025

失败

@HaixingOoO HaixingOoO requested a review from Copilot March 26, 2025 08:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the table component where the serial-number column was calculated incorrectly due to unsynchronized inner pagination data in controlled usage.

  • Extracts current and pageSize from the pagination property.
  • Adds a call to setInnerPagination to update internal state after pagination changes.
Comments suppressed due to low confidence (1)

packages/components/table/hooks/usePagination.tsx:45

  • [nitpick] Consider adding unit tests to verify that innerPagination is correctly synchronized in controlled scenarios, particularly ensuring that pageSize changes are properly reflected.
setInnerPagination({ current, pageSize });

Comment on lines +43 to +45
const { current, pageSize } = pagination;
updateDataSourceAndPaginate(current, pageSize);
setInnerPagination({ current, pageSize });
Copy link
Collaborator

Choose a reason for hiding this comment

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

建議添加判斷isEqual判斷,不相等才執行後面的事件

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

useEffect的依赖改成这样可好[pagination?.current, pagination?.pageSize, updateDataSourceAndPaginate]

HaixingOoO and others added 17 commits March 27, 2025 14:15
* fix(configprovider): fix ConfigProvider merge bug

* test(configprovider): update test snap

* chore: update snapshot

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* fix(Tabs): fix Tabs lazy not working

* test: add test example

* perf(tabs): optimize render TabPanel

* perf(tabs): clean code

* fix(tabs): fix type

* fix(tabpanel): fix TabPanel style

---------

Co-authored-by: Heising <heising@travelconnect.cn>
Co-authored-by: Uyarn <uyarnchen@gmail.com>
* fix(select): 解决select单选框在readonly模式下有光标和clear图标的问题

解决select单选框在readonly模式下有光标和clear图标的问题

#3414

* fix(select): 解决select单选框在readonly模式下有光标和clear图标的问题

解决select单选框在readonly模式下有光标和clear图标的问题

fix #3414

* fix(input): 修正了Input在readonly下如果设置了clearable,有光标和clear图标的问题

Input组件增加一个参数:allowInput,可选,默认值为 true,表示输入框是否可输入;修正了Input在readonly下如果设置了clearable,有光标和clear图标的问题

fix #3414

* fix(input): 使用useMemo/useCallback包括了常量和函数,提升基础组件Input的性能

使用useMemo/useCallback包括了常量和函数,提升基础组件Input的性能

fix #3414

* 还原Input文件,减少改动,减少review代码的工作量

* 因为参差修改涉及到了Input组件,需要重新跑test:snap-update更新快照

---------

Co-authored-by: Uyarn <uyarnchen@gmail.com>
* chore: update table demo

* chore: update snapshot
* feat(Descriptions): support tableLayout api

* chore: update snapshot

* chore: update snapshot

* chore: default value

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Uyarn <uyarnchen@gmail.com>
… and creatable (#3430)

* feat(select): options属性数据支持SelectOptionGroup类型

* fix(select): 修复children中ReactElement和map函数混写导致的数据异常

* feat(select): 分组选择器多选模式下支持全选功能

* feat(select): 分组选项器支持过滤

* fix(select): 修复options选择不到的问题

* fix(select): 调整Group的dom结构,移除多余的属性

* chore: update snapshot

* chore: update snapshot

* chore: remove commented-out code in Select components

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: wū yāng <uyarnchen@gmail.com>
* fix: fix esm bundle

* chore: fix bundle result

* chore: fix

* fix: fix ts production

* chore: fix eslint
…3432)

* docs: add demonstration for overriding floating layer style

* chore: use default values ​​for display
* fix: 🐛 getPareents error when tree data update

✅ Closes: 3461

* chore: revert change

---------

Co-authored-by: wū yāng <uyarnchen@gmail.com>
HaixingOoO and others added 7 commits March 28, 2025 21:51
* Release: 1.11.2

* chore: update common

* fix(input): fix Input readonly mode can show clear icon

* chore: revert change

* chore: changelog's changes

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Uyarn <uyarnchen@gmail.com>
* fix(Textarea): fix TextArea autofocus and autosize bug

* test: update test case

* fix(portal): fix Portal render child component

* test(textarea): update test case

---------

Co-authored-by: Heising <heising@travelconnect.cn>
* docs(config-provider): sync api

* chore: remove jumper

---------

Co-authored-by: wū yāng <uyarnchen@gmail.com>
@huangchen1031 huangchen1031 deleted the fix/use-pagination branch April 1, 2025 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants