Skip to content

fix(Cell): restore clickable behavior when to or url prop is set - #13894

Open
haoku123 wants to merge 1 commit into
youzan:mainfrom
haoku123:fix/cell-to-clickable
Open

fix(Cell): restore clickable behavior when to or url prop is set#13894
haoku123 wants to merge 1 commit into
youzan:mainfrom
haoku123:fix/cell-to-clickable

Conversation

@haoku123

Copy link
Copy Markdown

Description

Fixes #13868: since v4.10.0, Cells that only set the to or url prop (without an explicit clickable) no longer route on click.

Root Cause

v4.10.0 (#13846, fix(Field): prevent click event when disabled with is-link) changed onClick to only bind when clickable is true, but the clickable computation only considered the clickable and isLink props. The implicit clickable behavior of to / url (working since before v4.10.0) was silently dropped.

Changes

  • Cell.tsx: include to / url in the clickable computation:
    const clickable = Boolean(props.clickable ?? props.to ?? props.url ?? isLink)
  • The ?? chain keeps the explicit opt-out: clickable={false} still disables interaction (existing test still passes).
  • Added two regression tests for to-only and url-only cells.

Verification

v4.10.0 (youzan#13846) changed onClick to only bind when clickable is true,
but the clickable computation only considered the clickable and isLink
props. Cells that relied on the implicit clickable behavior of the to /
url props (working since before v4.10.0) stopped routing.

Include to / url in the clickable computation while keeping the
explicit clickable={false} opt-out.

Fixes youzan#13868
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.41%. Comparing base (ec5b45b) to head (c8d5e6e).
⚠️ Report is 282 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13894      +/-   ##
==========================================
- Coverage   89.60%   89.41%   -0.20%     
==========================================
  Files         257      257              
  Lines        7013     6698     -315     
  Branches     1736     1675      -61     
==========================================
- Hits         6284     5989     -295     
+ Misses        384      374      -10     
+ Partials      345      335      -10     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] 升级至4.10.0之后 Cell to 属性无效

2 participants