fix(signals): re-wake tracked readers after staged commits - #3293
fix(signals): re-wake tracked readers after staged commits#3293javascript-unsafe wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: e03137d The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
1fc2d8a to
2f96ddf
Compare
af4be24 to
e03137d
Compare
e03137d to
f043ae6
Compare
Coverage Report for CI Build 34019000424Coverage remained the same at 71.814%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
Closes #3291
What was broken
A signal written by a
refcallback was not observed by acreateTrackedEffectwhen the element was rendered through<Dynamic>inside a<Portal>.The write landed in the signal, but the tracked effect ran only once and kept observing the old value.
Root cause
The rc.6 Dynamic namespace fix made intrinsic elements lazy. In a Portal, that moves
spread()and the ref write into the render-effect phase. The tracked effect is notified before the staged signal value is committed, but committed-visibility reads intentionally return the old value. The commit then updated the signal without waking the tracked subscriber again.Fix
Reuse the existing missed-wake latch when a committed-visibility reader observes a staged signal value. When the signal commits, tracked subscribers are queued again so they observe the committed value.
Tests
createTrackedEffect+Dynamic+Portal+ref.packages/web:npx vitest run test/portal-dynamic-ref-3291.spec.tsxcreateTrackedEffect.test.ts,effect-phase-writes.test.ts, andtreeshake.test.ts