Repository navigation
fix(signals): preserve signed zero in staged signal reads - #4538
Conversation
Split the netted-read return from the committed-screen return introduced by solidjs#4498. Strict equality identifies opposite signed zeros, so a write accepted by Object.is or equals: false must serve the staged payload itself. Keep the existing netting order and comparator behavior. Add observed reciprocal regressions for both signed-zero directions and both comparator options, plus a default-comparator control.
🦋 Changeset detectedLatest commit: 6b2a19e The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 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 |
…ed-zero-staged-read
Guard netting with SameValue as well as strict equality. Apply it to fast and strict reads, verdict routing and the seat oracle, preserving accepted NaN rewrites. Cover pending/reveal atomicity with plain and latest readers across action write locations.
Merging this PR will regress 1 benchmark1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Summary
After #4498, an observed
createMemo(() => 1 / value())overcreateSignal(-0, { equals: Object.is })stays at-InfinityaftersetValue(0), even though the signal commits+0. With an async action holding the write, the same equality shortcut also reports the write as not pending and loses the reader's replay at reveal. Both signed-zero directions andequals: falseare affected.Require
Object.isas well as the existing strict comparison when identifying netted staging, in the fast read, strict slow read and verdict-routing paths. The test-only reader-seat table uses the same criterion. Opposite signed zeros remain distinct proposals; an acceptedNaNrewrite retains its previous behavior because the strict comparison remains. User comparators, netting priority and allocation/state layout are unchanged.Adds 22 regression/control cases: ordinary derivations, held plain reads versus
latest, trackedisPending, both write locations around an action, strict reads, default equality and an accepted NaN rewrite, plus a patch changeset.How did you test this change?
next@215c3652, 20 new cases fail and two controls pass. All 22 pass with the fix. Together with the existing netting regressions, all 31 focused tests pass in development, production and observe configurations.npm run build:js,npm run typesinpackages/signals).vitest run --maxWorkers=2).git diff --checkandnode scripts/check-release-invariants.mjspass.