Skip to content

fix: default missing horizontal offset - #384

Merged
yoyo837 merged 1 commit into
react-component:masterfrom
nrps9909:codex/guard-undefined-horizontal-offset
Aug 28, 2026
Merged

fix: default missing horizontal offset#384
yoyo837 merged 1 commit into
react-component:masterfrom
nrps9909:codex/guard-undefined-horizontal-offset

Conversation

@nrps9909

@nrps9909nrps9909 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • default the optional horizontal filler offset to zero before negating it
  • cover both LTR and RTL margin properties when offsetX is omitted

Why

FillerProps.offsetX is optional, but the virtual positioning branch negated it directly. Rendering that supported state produced React's NaN is an invalid value for the marginLeft css style property warning and omitted the intended zero margin.

Closes#298.

Validation

  • exact-base regression: failed with the React NaN warning and missing zero margin
  • focused regression: 2/2 passed for LTR and RTL
  • full test suite: 9 suites, 282 tests passed
  • TypeScript, focused ESLint, Prettier, ESM/CJS/declaration compilation, and diff checks passed

AI assistance disclosure: Codex was used to trace the offset path, construct the failing regression, implement the minimal fallback, run validation, and draft this PR. I reviewed the diff and all reported results before submission.

Summary by CodeRabbit

  • Bug 修复

    • 修复未提供水平偏移量时可能生成无效样式的问题。
    • 在不同文字方向下,内容默认正确设置为 0px 外边距。
  • 测试

    • 新增测试,覆盖省略水平偏移量时的默认表现。

@vercel

vercelBot 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

codecovBot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.60%. Comparing base (579a3bf) to head (8f3cb45).

Additional details and impacted files
@@ Coverage Diff @@## master #384 +/- ##
=======================================
Coverage 97.60% 97.60% =======================================
Files 19 19 Lines 836 836 Branches 209 205 -4 =======================================
Hits 816 816 Misses 20 20 

☔ 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

coderabbitaiBot 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: aa113d97-2fe7-4c80-8b65-98a455516212

📥 Commits

Reviewing files that changed from the base of the PR and between 82a99ec and 8f3cb45.

📒 Files selected for processing (1)
  • src/Filler.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Filler.tsx

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


Walkthrough

FilleroffsetX 未定义、为空或为 0 时使用 0 计算水平 margin。新增测试验证 rtlfalsetrue 时的默认 margin。

Changes

Filler 水平偏移处理

Layer / File(s)Summary
水平偏移默认值与测试
src/Filler.tsx, tests/filler.test.tsx
innerStyle 使用 `-offsetX

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

Merge Risk:⚪ Minimal · up to 8f3cb

The change defaults an omitted horizontal offset to zero for both LTR and RTL rendering, preventing the reported invalid CSS value. No actionable merge-blocking risk remains after the stated validation.

Poem

小兔看到偏移归零,
Filler 计算不再出错。
左边右边各有默认,
测试覆盖两种方向。
NaN 警告安静躲好。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ Passed标题准确概括了本次变更:为缺失的水平偏移设置默认值。
Linked Issues check✅ Passed变更解决了问题 #298。代码在缺少 offsetX 时将水平边距设为 0,避免产生 NaN。LTR 和 RTL 场景均有回归测试。
Out of Scope Changes check✅ Passed变更仅包含 Filler.tsx 的相关修复和对应的 LTR/RTL 测试。未发现与问题 #298 无关的代码变更。
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

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

Comment threadsrc/Filler.tsx Outdated
@nrps9909
nrps9909force-pushed the codex/guard-undefined-horizontal-offset branch from 82a99ec to 8f3cb45CompareAugust 28, 2026 10:44
@yoyo837
yoyo837 merged commit a7cdfda into react-component:masterAug 28, 2026
11 of 12 checks passed
Sign up for freeto 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.

Warning: NaN is an invalid value for the marginLeft css style property.

2 participants

@nrps9909@yoyo837