Skip to content

Add virtual data bindings#513

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

Add virtual data bindings#513
titouanmathis wants to merge 2 commits into
feature/data-scopefrom
feature/data-bindings

Conversation

@titouanmathis

Copy link
Copy Markdown
Contributor

Summary

  • add virtual data-bind:* attributes to apply one Data value to multiple DOM targets
  • support property, attribute, class, style, and text bindings with value, target, and $data expressions
  • preserve element content by replacing the legacy single-property write when virtual bindings are present
  • handle HTML property-name casing, boolean/removal semantics, expression isolation, and equal-value dispatch
  • document the API with a Tabs-like Action/Data example

This is a 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, 310 tests passed, 3 skipped, 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.

Part of #510.
Depends on #511.

@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 virtual data-bind:* bindings so one data value can drive multiple DOM updates on the same element, and documents the new API with a Tabs-style example. It also adds tests for property-name resolution, attribute/class/style semantics, scoped expressions, and equal-value dispatch.

Still open from earlier reviews (1 finding):

  • packages/ui/Data/DataBind.ts:22issue: Acronym-cased DOM properties are mapped incorrectly

Review usage: 209,237 in (155,136 cached) / 8,180 out tokens — $0.2967 (cloudflare-ai-gateway/gpt-5.4, thinking: medium)

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

Previous review runs

Previous run archived 2026-07-15T15:17:27Z

Code Review

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

This MR adds virtual data-bind:* bindings to DataBind, updates dispatch semantics so virtual subscribers still refresh on equal-value updates, and documents the new API with a Tabs-like example. The implementation and tests cover property, attribute, class, style, and text bindings, plus scoped $data expressions and per-binding error isolation.

1 issue found:

  • issuepackages/ui/Data/DataBind.ts:22 — Acronym-cased DOM properties are mapped incorrectly

Review usage: 66,015 in (44,544 cached) / 7,495 out tokens — $0.1772 (cloudflare-ai-gateway/gpt-5.4, thinking: medium)

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

Comment thread packages/ui/Data/DataBind.ts Outdated
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.18182% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.70%. Comparing base (7d58c48) to head (b798bb1).

Files with missing lines Patch % Lines
packages/ui/Data/DataBind.ts 98.18% 1 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##             feature/data-scope     #513      +/-   ##
========================================================
- Coverage                 79.45%   78.70%   -0.75%     
  Complexity                  145      145              
========================================================
  Files                       100       94       -6     
  Lines                      3008     2874     -134     
  Branches                    532      502      -30     
========================================================
- Hits                       2390     2262     -128     
+ Misses                      542      536       -6     
  Partials                     76       76              
Flag Coverage Δ
unittests 78.70% <98.18%> (-0.75%) ⬇️

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 98.25% <98.18%> (-0.05%) ⬇️

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

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