Skip to content

fix: honor zero rail width - #326

Merged
yoyo837 merged 1 commit into
react-component:masterfrom
nrps9909:codex/zero-rail-width
Aug 28, 2026
Merged

fix: honor zero rail width#326
yoyo837 merged 1 commit into
react-component:masterfrom
nrps9909:codex/zero-rail-width

Conversation

@nrps9909

@nrps9909 nrps9909 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve an explicit railWidth={0} for line progress
  • preserve the same value for circle progress
  • cover both renderers with a regression test

Problem

Both renderers selected the rail width with railWidth || strokeWidth. Because zero is a valid numeric SVG stroke width, explicitly setting railWidth={0} was replaced by the track strokeWidth and the rail remained visible. Nullish fallback keeps the documented default behavior for omitted values while honoring zero.

Validation

  • rc-test --runInBand (4 suites, 21 tests, 11 snapshots)
  • tsc --noEmit
  • ESLint on src/ (no errors; one existing unused-disable warning)
  • Prettier and git diff --check

I checked the current issues and open PRs, including #214, whose Line.tsx change concerns zero-length subpath opacity rather than rail width. I found no duplicate for zero railWidth handling.

Summary by CodeRabbit

  • Bug 修复

    • 修复进度条轨道宽度设置为 0 时被错误回退的问题。
    • LineCircle 组件现可正确应用 railWidth={0}
  • 测试

    • 新增测试,验证轨道描边宽度为 0 时的显示结果。

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@nrps9909 is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.35%. Comparing base (2f59aea) to head (c47631d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #326   +/-   ##
=======================================
  Coverage   99.35%   99.35%           
=======================================
  Files           7        7           
  Lines         156      156           
  Branches       52       52           
=======================================
  Hits          155      155           
  Misses          1        1           

☔ View full report in Codecov by Harness.
📢 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.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f43ea6f0-9673-4026-9914-baf810447ace

📥 Commits

Reviewing files that changed from the base of the PR and between 2f59aea and c47631d.

📒 Files selected for processing (3)
  • src/Circle/index.tsx
  • src/Line.tsx
  • tests/index.spec.js

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

本次修改让 LineCirclerailWidth={0} 时保留零值,并新增测试验证两个 rail 元素的 stroke-width 属性。

Changes

轨道宽度处理

Layer / File(s) Summary
轨道宽度回退与零值验证
src/Circle/index.tsx, src/Line.tsx, tests/index.spec.js
LineCircle 将 `railWidth

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to c4763

The change preserves an explicitly configured rail width of zero for line and circle progress while retaining defaults for omitted values, with regression coverage for both renderers. No actionable merge-blocking risk remains after normal checks and review.

Poem

小兔看见零轨道,
描边宽度不再逃。
Line、Circle 同步跑,
测试确认结果好。
空值才会用回退,
代码轻轻跳一跳。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题“fix: honor zero rail width”准确概括了主要变更:Line 和 Circle 组件支持使用显式的 railWidth={0},并且标题简洁明确。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@yoyo837
yoyo837 merged commit 090325f into react-component:master Aug 28, 2026
10 of 11 checks passed
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.

2 participants