Skip to content

Conversation

@zombieJ
Copy link
Member

@zombieJ zombieJ commented Mar 10, 2025

ref ant-design/ant-design#52928

Summary by CodeRabbit

  • Bug Fixes
    • 优化了固定列阴影的显示逻辑,使阴影仅在合适的滚动位置呈现,从而改善了视觉体验。

@vercel
Copy link

vercel bot commented Mar 10, 2025

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 Mar 10, 2025 11:02am

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2025

Walkthrough

此次 PR 修改了 Cell 函数中的阴影显示逻辑,通过引入新的计算方式来判断固定列两侧是否显示阴影。新逻辑通过计算 (absScroll - fixStart)(scrollWidth - absScroll - fixEnd) 是否大于等于 1,以提高判断精度。此次改动仅涉及内部逻辑,更精确地决定何时显示开始与结束阴影,未修改对外接口或公共实体。

Changes

文件 变更摘要
src/Cell/index.tsx 更新了固定列阴影显示判断逻辑,采用 (absScroll - fixStart) >= 1(scrollWidth - absScroll - fixEnd) >= 1 的新方式。

Sequence Diagram(s)

sequenceDiagram
    participant Cell as Cell 组件
    participant Scroll as 滚动状态
    participant Calc as 计算逻辑

    Cell->>Scroll: 获取滚动位置 (absScroll) 与总宽度 (scrollWidth)
    Cell->>Calc: 计算 (absScroll - fixStart) 是否 >= 1
    Cell->>Calc: 计算 (scrollWidth - absScroll - fixEnd) 是否 >= 1
    Calc-->>Cell: 返回开始/结束阴影显示结果
    Cell->>Cell: 根据判断结果显示或隐藏阴影
Loading

Possibly related PRs

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/Cell/index.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.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b135dd4 and 42f33a3.

📒 Files selected for processing (1)
  • src/Cell/index.tsx (1 hunks)
🔇 Additional comments (1)
src/Cell/index.tsx (1)

146-155: 优化了固定列阴影显示的精确度

这个改动通过引入更精确的计算方式来控制固定列两侧阴影的显示。原来的逻辑可能在某些边界情况下不必要地显示阴影,而新的实现通过确保差值大于等于1才显示阴影,提供了更好的用户体验。

代码中的注释也很好地解释了这一设计意图:"For precision, we not show shadow by default which has better user experience"(为了精确起见,默认不显示阴影,这样用户体验更好)。

✨ 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.

❤️ Share
🪧 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.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in 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 generate unit testing code.
    • @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.

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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

(isFixStart && fixedStartShadow && absScroll) -
// For precision, we not show shadow by default which has better user experience.
(fixStart as number) >=
1;
Copy link
Member

Choose a reason for hiding this comment

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

哈哈,安卓滚动有0.几的误差

Copy link
Member Author

Choose a reason for hiding this comment

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

默认小于 1 的就不展示了,这样也就是少一点距离出现阴影。比永远有阴影舒服,哈哈哈~

@codecov
Copy link

codecov bot commented Mar 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.02%. Comparing base (b135dd4) to head (42f33a3).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1246   +/-   ##
=======================================
  Coverage   98.02%   98.02%           
=======================================
  Files          76       76           
  Lines        7385     7391    +6     
  Branches     1138     1138           
=======================================
+ Hits         7239     7245    +6     
  Misses        140      140           
  Partials        6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zombieJ zombieJ merged commit 282291f into master Mar 10, 2025
11 of 12 checks passed
@zombieJ zombieJ deleted the precision branch March 10, 2025 11:05
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.

3 participants