Skip to content

feat(list): add Spin overlay for loading and use Empty.PRESENTED_IMAGE_SIMPLE#9511

Merged
chenshuai2144 merged 1 commit intoant-design:masterfrom
leshalv:master
Feb 26, 2026
Merged

feat(list): add Spin overlay for loading and use Empty.PRESENTED_IMAGE_SIMPLE#9511
chenshuai2144 merged 1 commit intoant-design:masterfrom
leshalv:master

Conversation

@leshalv
Copy link
Collaborator

@leshalv leshalv commented Feb 26, 2026

feat(list): add Spin overlay for loading and use Empty.PRESENTED_IMAGE_SIMPLE

  • Wrap list body in Spin with spinning={isLoading}
  • Replace default Empty with PRESENTED_IMAGE_SIMPLE

Summary by CodeRabbit

更新说明

  • 功能改进
    • 列表加载时现在显示加载动画,提供更清晰的加载状态提示
    • 优化空状态显示,采用更简洁的视觉设计

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 26, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @leshalv, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the user experience of lists by introducing a loading spinner that activates when data is being fetched, and by standardizing the empty state display with a simpler, predefined image. These changes provide clearer visual feedback to users, improving the perceived performance and consistency of list components.

Highlights

  • Loading Indicator: Implemented a Spin overlay that wraps the list body, providing a visual loading state controlled by the isLoading prop.
  • Empty State Enhancement: Replaced the default Empty component's description with Empty.PRESENTED_IMAGE_SIMPLE for a more streamlined empty state display.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/list/ProListBase.tsx
    • Imported the Spin component from antd.
    • Modified the Empty component to use Empty.PRESENTED_IMAGE_SIMPLE instead of a custom description.
    • Wrapped the main content of the list with the Spin component, making its spinning prop conditional on the isLoading state.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

ProListBase.tsx 的列表加载与空状态 UI 得以优化。新增 Spin 组件用于展示加载状态,并将空状态显示改为简洁的图像样式,进一步提升用户体验。

Changes

Cohort / File(s) Summary
列表加载与空状态优化
src/list/ProListBase.tsx
导入 Spin 组件并包装列表内容以显示加载状态;将空状态从文本描述"暂无数据"改为使用 Empty.PRESENTED_IMAGE_SIMPLE 简洁图像。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Spin 转转,空状态藏,
加载器轻轻亮,
Empty 图简又美,
列表焕新颜。✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题清晰准确地总结了两个主要变更:添加加载状态的Spin组件和使用Empty.PRESENTED_IMAGE_SIMPLE,与代码改动完全相符。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot bot added enhancement New feature or request list labels Feb 26, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a <Spin> overlay for loading states and updates the empty state component to use Empty.PRESENTED_IMAGE_SIMPLE. The changes are a good improvement for user experience. However, I've identified a couple of related issues in ProListBase.tsx where the new <Spin> component doesn't behave as a true overlay due to existing logic, and there's a latent bug that can cause children to be rendered twice. My review comment provides more details on these points.

Comment on lines +511 to +519
<Spin spinning={isLoading}>
{showPaginationTop && paginationNode}
{header && <div className={`${prefixCls}-header`}>{header}</div>}
{childrenContent}
{children}
{footer && <div className={`${prefixCls}-footer`}>{footer}</div>}
{loadMore}
{showPaginationBottom && paginationNode}
</Spin>
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This change to use <Spin> for loading is a good one. However, it interacts with some existing logic in ways that might be unintended. There are two issues to consider:

  1. Loading overlay behavior: The spinner won't function as a true overlay on stale data. This is because when isLoading is true, the list's content (childrenContent) is replaced by a placeholder div (see lines 453-454). This causes the list to appear empty during loading, rather than showing the spinner over the old content. For a better user experience, you might want to remove that logic so the spinner overlays the stale data.

  2. Duplicate rendering of children: There's a pre-existing bug where children can be rendered twice. This happens when dataSource is empty but children are provided. The logic at line 456 sets childrenContent = children, and then both are rendered within the <Spin> component, causing duplication. This should be addressed by refactoring the childrenContent logic.

Both issues are related to how childrenContent is determined outside of this changed block. I'd recommend addressing them for this feature to work correctly and to fix the underlying bug.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/list/ProListBase.tsx (1)

448-448: 确认是否需要保留空状态描述文本。

原代码可能包含 description="暂无数据" 的自定义描述,现在改为使用 Empty.PRESENTED_IMAGE_SIMPLE 后未设置 description,将显示 antd 默认的 "No Data" 文本。如果需要保持中文描述或依赖 ConfigProvider 的国际化配置,请确认此行为符合预期。

💡 如需保留描述文本的可选方案
-          <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
+          <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/list/ProListBase.tsx` at line 448, The Empty component usage in
ProListBase.tsx was changed to use Empty.PRESENTED_IMAGE_SIMPLE but removed the
description, which will show Antd's default "No Data" text; decide whether to
restore the original Chinese description or rely on ConfigProvider i18n and, if
restoring, add a description prop back to the Empty element (e.g.,
description="暂无数据") or wire it to your localization helper/ConfigProvider so the
Empty in ProListBase renders the intended localized text instead of the default.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/list/ProListBase.tsx`:
- Around line 511-519: The code currently renders children twice because when
splitDataSource is empty you assign childrenContent = children and then render
both {childrenContent} and {children}; remove the redundant standalone
{children} render in the JSX inside the Spin so only {childrenContent} is
rendered (ensure childrenContent logic still falls back to children when
appropriate), referencing childrenContent, children, splitDataSource and
isLoading to locate and verify the fix.

---

Nitpick comments:
In `@src/list/ProListBase.tsx`:
- Line 448: The Empty component usage in ProListBase.tsx was changed to use
Empty.PRESENTED_IMAGE_SIMPLE but removed the description, which will show Antd's
default "No Data" text; decide whether to restore the original Chinese
description or rely on ConfigProvider i18n and, if restoring, add a description
prop back to the Empty element (e.g., description="暂无数据") or wire it to your
localization helper/ConfigProvider so the Empty in ProListBase renders the
intended localized text instead of the default.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 003548e and 9574b85.

📒 Files selected for processing (1)
  • src/list/ProListBase.tsx

Comment on lines +511 to +519
<Spin spinning={isLoading}>
{showPaginationTop && paginationNode}
{header && <div className={`${prefixCls}-header`}>{header}</div>}
{childrenContent}
{children}
{footer && <div className={`${prefixCls}-footer`}>{footer}</div>}
{loadMore}
{showPaginationBottom && paginationNode}
</Spin>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n src/list/ProListBase.tsx | sed -n '450,520p'

Repository: ant-design/pro-components

Length of output: 2909


🏁 Script executed:

cat -n src/list/ProListBase.tsx | sed -n '430,460p'

Repository: ant-design/pro-components

Length of output: 1286


🏁 Script executed:

cat -n src/list/ProListBase.tsx | sed -n '505,525p' && echo "---" && rg -n "children" src/list/ProListBase.tsx | grep -E "(line 515|{children})" | head -20

Repository: ant-design/pro-components

Length of output: 991


🏁 Script executed:

cat -n src/list/ProListBase.tsx | sed -n '155,175p'

Repository: ant-design/pro-components

Length of output: 782


🏁 Script executed:

# Check for any comments around line 515 or in the broader render section
cat -n src/list/ProListBase.tsx | sed -n '500,525p' | grep -i "comment\|todo\|fixme\|hack\|bug" || echo "No comments found in render section"

# Also check the git history of this line to see if there's context
git log --oneline -p src/list/ProListBase.tsx 2>/dev/null | grep -A10 -B10 "children}" | head -50 || echo "Git history not available"

Repository: ant-design/pro-components

Length of output: 1534


在特定条件下 children 被重复渲染。

splitDataSource 为空、存在 children 且非加载状态时,第 456 行将 childrenContent 赋值为 children。此时第 514 行 {childrenContent} 和第 515 行 {children} 会导致 children 被渲染两次。此外,第 515 行的独立渲染在其他条件分支中也显得冗余。

🐛 建议移除重复的 children 渲染
          <Spin spinning={isLoading}>
            {showPaginationTop && paginationNode}
            {header && <div className={`${prefixCls}-header`}>{header}</div>}
            {childrenContent}
-            {children}
            {footer && <div className={`${prefixCls}-footer`}>{footer}</div>}
            {loadMore}
            {showPaginationBottom && paginationNode}
          </Spin>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Spin spinning={isLoading}>
{showPaginationTop && paginationNode}
{header && <div className={`${prefixCls}-header`}>{header}</div>}
{childrenContent}
{children}
{footer && <div className={`${prefixCls}-footer`}>{footer}</div>}
{loadMore}
{showPaginationBottom && paginationNode}
</Spin>
<Spin spinning={isLoading}>
{showPaginationTop && paginationNode}
{header && <div className={`${prefixCls}-header`}>{header}</div>}
{childrenContent}
{footer && <div className={`${prefixCls}-footer`}>{footer}</div>}
{loadMore}
{showPaginationBottom && paginationNode}
</Spin>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/list/ProListBase.tsx` around lines 511 - 519, The code currently renders
children twice because when splitDataSource is empty you assign childrenContent
= children and then render both {childrenContent} and {children}; remove the
redundant standalone {children} render in the JSX inside the Spin so only
{childrenContent} is rendered (ensure childrenContent logic still falls back to
children when appropriate), referencing childrenContent, children,
splitDataSource and isLoading to locate and verify the fix.

@chenshuai2144 chenshuai2144 merged commit bb3f276 into ant-design:master Feb 26, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request list size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants