Skip to content

Add data mutation helpers#514

Open
titouanmathis wants to merge 2 commits into
feature/data-scopefrom
feature/data-mutations
Open

Add data mutation helpers#514
titouanmathis wants to merge 2 commits into
feature/data-scopefrom
feature/data-mutations

Conversation

@titouanmathis

Copy link
Copy Markdown
Contributor

Summary

  • add toggle(), increment(), and cycle() helpers to DataBind
  • normalize comparisons across DOM string coercion, dates, and arrays
  • keep all mutations routed through set() so scalar and scoped groups continue to dispatch normally
  • document Action usage and helper semantics
  • cover custom/default toggles, numeric recovery, negative steps, value cycling, scoped state, and Action integration

This is an independent stacked follow-up to #511 and should be reviewed against feature/data-scope. Once #511 merges, this PR can be retargeted to main.

Validation

  • npm run test — 47 files passed, 305 tests passed, 3 skipped, 1 todo
  • focused npm run test -- -- Data Action — 9 files passed, 55 tests passed, 1 todo
  • npm run lint:types — passed
  • npm run lint:static — passed with 15 pre-existing warnings and no errors
  • npm run lint:prettier — passed
  • npm run build — passed

No local docs build was run.

Follow-up to #510.
Depends on #511.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.41%. Comparing base (7d58c48) to head (ad143cd).

Files with missing lines Patch % Lines
packages/ui/Data/DataBind.ts 88.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##             feature/data-scope     #514      +/-   ##
========================================================
- Coverage                 79.45%   78.41%   -1.04%     
  Complexity                  145      145              
========================================================
  Files                       100       94       -6     
  Lines                      3008     2845     -163     
  Branches                    532      499      -33     
========================================================
- Hits                       2390     2231     -159     
+ Misses                      542      537       -5     
- Partials                     76       77       +1     
Flag Coverage Δ
unittests 78.41% <88.00%> (-1.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/ui/Data/DataBind.ts 96.50% <88.00%> (-1.81%) ⬇️

... and 13 files with indirect coverage changes

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

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Code Review

Risk: Low — no blocking issues; safe to merge aside from nits.

This MR adds toggle(), increment(), and cycle() to DataBind, documents the new API, and extends the test suite with helper, scoped-state, and Action integration coverage. The implementation generally follows the stated intent of routing mutations through set(), but one unsupported toggle shape is still accepted and does not round-trip correctly.

Still open from earlier reviews (1 finding):

  • packages/ui/Data/DataBind.ts:255issue: Custom toggle values do not round-trip on checkboxes

Review usage: 111,081 in (89,088 cached) / 8,996 out tokens — $0.2122 (cloudflare-ai-gateway/gpt-5.4, thinking: medium)

Reviewed by @weareikko/code-review v0.8.2 for commit ad143cd.

Previous review runs

Previous run archived 2026-07-15T15:37:32Z

Code Review

Risk: Medium — issues that should be addressed before merge.

Adds toggle(), increment(), and cycle() to DataBind, introduces a shared value comparison helper for DOM/string/date/array cases, and expands the API docs. The test suite now covers the new helpers, Action integration, and scoped state propagation.

1 issue found:

  • issuepackages/ui/Data/DataBind.ts:245 — Custom toggle values do not round-trip on checkboxes

Review usage: 120,167 in (86,016 cached) / 11,191 out tokens — $0.2747 (cloudflare-ai-gateway/gpt-5.4, thinking: medium)

Reviewed by @weareikko/code-review v0.8.2 for commit 27a8fbb.

Comment thread packages/ui/Data/DataBind.ts
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.

1 participant