fix(useAntdTable): defaultCurrent option not applied on initial render#2918
Draft
fix(useAntdTable): defaultCurrent option not applied on initial render#2918
Conversation
|
|
Copilot
AI
changed the title
[WIP] Fix defaultCurrent parameter in useAntdTable pagination
fix(useAntdTable): defaultCurrent option not applied on initial render
Mar 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
useAntdTableignored thedefaultCurrentoption, always starting pagination at page 1 regardless of the configured value.Root Cause
_submit's fallback pagination andsubmit's initial call both hardcodedcurrent: 1without checkingoptions.defaultCurrent. SinceuseAntdTabledrives initial fetching through_submit(not throughusePagination'sdefaultParams), thedefaultCurrentvalue was never applied.Fix
Two one-line changes in
useAntdTable/index.tsx:_submitfallback:current: 1→current: options.defaultCurrent || 1submitinitial call:current: 1→current: options.defaultCurrent || 1reset()intentionally retainscurrent: 1— resetting should always return to page 1.🤔 这个变动的性质是?
🔗 相关 Issue
[useAntdTable] defaultCurrent parameter not working as expected
💡 需求背景和解决方案
useAntdTable的defaultCurrent选项未生效,初始分页始终为第 1 页。原因:
_submit的回退分页参数和submit的初始调用均硬编码了current: 1,未读取options.defaultCurrent。修复:将上述两处改为
options.defaultCurrent || 1。reset()保持current: 1不变(重置应回到第 1 页)。📝 更新日志
useAntdTable: fixdefaultCurrentoption being ignored on initial renderuseAntdTable:修复defaultCurrent参数在初始渲染时未生效的问题☑️ 请求合并前的自查清单
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.