fix: emptyNode should not shaked when horizontal scroll
fix https://github.com/ant-design/ant-design/issues/49279
虽然不会有位置上的变动,但是这样会展示一下白屏再展示 Empty,体验会好一些。
问题的本质是因为第一次 render 时无法获取到 componentWidth 并展示。componentWidth 是 ResizeObserver 监听后 setComponentWidth 上去的。
或许 ResizeObserver 改用 useLayoutEffect 监听宽度可完美解?
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| table | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 14, 2025 9:09am |
Table 的一些时序可以合并掉。不过要重构就比较麻烦。现在如果是白屏的话,ssr 体验就比较糟糕了(我印象里header就是白的,就不太好)。
这样闪一下体验更糟吧
冲突解决一下我合并
@linxianxi is attempting to deploy a commit to the React Component Team on Vercel.
A member of the Team first needs to authorize it.
Walkthrough
本次更改在 ExpandedRow 组件中,为根元素添加了条件性的 visibility 样式。当行为空、允许横向滚动且组件宽度为假值时,将 visibility 设为 hidden,以解决空状态初始渲染时的显示问题。
Changes
| 文件/文件组 | 变更摘要 |
|---|---|
| src/Body/ExpandedRow.tsx | 在根元素样式中增加了条件性的 visibility 属性,用于特定条件下隐藏空状态内容。 |
Sequence Diagram(s)
sequenceDiagram
participant Parent
participant ExpandedRow
Parent->>ExpandedRow: 渲染组件,传递 isEmpty、horizonScroll、componentWidth 等属性
ExpandedRow->>ExpandedRow: 判断 isEmpty && horizonScroll && !componentWidth
alt 条件成立
ExpandedRow->>ExpandedRow: 设置 visibility: 'hidden'
else 条件不成立
ExpandedRow->>ExpandedRow: visibility 不变
end
ExpandedRow->>Parent: 渲染结果
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| 空状态在横向滚动时应一开始居中显示,避免初始闪动 (#49279) | ✅ |
Suggested reviewers
- zombieJ
- afc163
Poem
🐇 空行闪现一瞬间,
代码轻抚隐形帘。
横滚之下藏玄机,
居中展现不再偏。
小兔欢跳来贺变!
[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
src/Body/ExpandedRow.tsx
Oops! Something went wrong! :(
ESLint: 8.57.1
ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.
The config "prettier" was referenced from the config file in "/.eslintrc.js".
If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.
[!TIP]
⚡️ Faster reviews with caching
- CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure
Review - Disable Cacheat either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off theData Retentionsetting under your Organization Settings.Enjoy the performance boost—your workflow just got faster.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Explain this complex logic. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.