Skip to content

fix(agera,kida,nanoviews,query): run user reducers and event handlers untracked - #193

Merged
dangreen merged 1 commit into
mainfrom
fix/untracked-user-callbacks
Aug 10, 2026
Merged

fix(agera,kida,nanoviews,query): run user reducers and event handlers untracked#193
dangreen merged 1 commit into
mainfrom
fix/untracked-user-callbacks

Conversation

@dangreen

Copy link
Copy Markdown
Member

Two tracking barriers around code the library user writes, found by a repo-wide audit of untracked coverage.

  • nextValue calls the reducer form of a signal write with tracking off, so $signal(value => value + $other()) no longer subscribes whatever effect performs the write; it also takes an extra argument to pass to the reducer
  • route the query cache setter and kida child setter through nextValue instead of their own isFunction branches
  • run delegated event handlers untracked: an event dispatched synchronously from an effect - element.focus() under autoFocus$ - no longer subscribes that effect to what the handler reads, which could steal focus back on every unrelated change

Every fix has a regression test that is red without it: signal.spec.ts (the core reducer), array.spec.ts (updateArray), cache.spec.ts ($data), effects.spec.ts (delegated events).

Measured along the way: rest parameters for the reducer argument are ~2.3x slower than a single optional one, so the signature takes one argument; pushActiveSub() without the explicit undefined is perf-neutral but costs bytes, so the call sites keep it.

Sizes: agera 2730 / 1345 / 1513 / 1927, kida 4188 / 1349 / 2273, nanoviews 6845 / 4044, store 5609 / 1349 / 2274 - the core barrier reaches every bundle because it sits in the single funnel of functional writes. Suites: agera 126 + 1 expected fail, kida 62, store 57, nanoviews 73, query 163, router 129.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.59%. Comparing base (244fafc) to head (39c5eec).

Files with missing lines Patch % Lines
...ackages/nanoviews/src/internals/elements/events.ts 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #193      +/-   ##
==========================================
+ Coverage   84.54%   84.59%   +0.05%     
==========================================
  Files         139      139              
  Lines        3112     3116       +4     
  Branches      580      578       -2     
==========================================
+ Hits         2631     2636       +5     
  Misses        343      343              
+ Partials      138      137       -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.

… untracked

- `nextValue` calls the reducer form of a signal write with tracking off, so `$signal(value => value + $other())` no longer subscribes whatever effect performs the write; it also takes an extra argument to pass to the reducer
- route the query cache setter and kida child setter through `nextValue` instead of their own `isFunction` branches
- run delegated event handlers untracked: an event dispatched synchronously from an effect - `element.focus()` under `autoFocus$` - no longer subscribes that effect to what the handler reads, which could steal focus back on every unrelated change
@dangreen
dangreen force-pushed the fix/untracked-user-callbacks branch from 899f30b to 39c5eec Compare August 10, 2026 21:33
@dangreen
dangreen merged commit 03c78db into main Aug 10, 2026
10 checks passed
@dangreen
dangreen deleted the fix/untracked-user-callbacks branch August 10, 2026 22:15
@github-actions github-actions Bot mentioned this pull request Aug 10, 2026
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