Repository navigation
fix(octane): re-evaluate a ready derived invalidated before a held transition is accepted - #1816
Merged
Merged
Conversation
…ansition is accepted Promoting a redeclared derived view carried its pre-acceptance Dirty/Pending flags onto the canonical cell only when the view was pending. A ready view whose new dependency changed while a held View Transition staged the render was promoted clean, so the committed cell and its moved consumers kept the stale value. Preserve the invalidation for any evaluated view and retry its consumers. Fixes #1767 Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 6, 2026 12:42
Contributor
Benchmark report🟢 No budget breaches, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 60 measured values. Public-import reachability bundles (bytes)No changes across 105 measured values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1767. When a held View Transition is staging a render that redeclared a
derived$, and the new definition's dependency changes before the browser accepts the update, the accepted cell now re-evaluates. Previously it committed the stale value, which rendering and event-handler reads then kept showing.Why
promoteDeclarationView(packages/octane/src/signals/graph.ts) copies the private declaration view's state onto the canonical cell at acceptance. #1775 taught it to keep the view's pre-acceptanceDirty/Pendingflags and retry moved consumers, but only for a pending view. A ready view invalidated by its new dependency during the hold was promoted with its flags cleared. The cell held the old ready value with clean flags, so nothing re-read it:old→ dependency set while held → accept) renderedoldandget()returnedold.Changes
promoteDeclarationView: preserve the view'sDirty/Pendinginvalidation for any evaluated view, not only a pending one. Then use the existing retry path: bump the revision, invalidate render witnesses, and propagate to the moved consumers. An unevaluated view is unchanged, because it already installsDirtythrough its own path.invalidatedPending/retryPendinglocals are renamed toinvalidated/retry, since they are no longer pending-only.signals-staged-invalidation.test.tswith fixture. It runs in the dev, prod and Strong signal projects and covers:oldwithout looping.Validation
expected 'old' to be 'new'). The fix was also reverted locally to confirm the test goes red again.signals-staged-invalidation.test.tspasses 15/15 acrossoctane-signals,octane-signals-prodandoctane-signals-strong.signals-pending-promotion,signals-pending-promotion-graph,signals-waiter-equivalent) and the redeclaration suites (signals-local,signals-local-chains,signals-update-depth) pass inoctane-signals, 38/38.pnpm typecheck:filesandpnpm format:files:checkpass on the changed files.pnpm syncproduced no changes.pnpm test,pnpm typecheckandpnpm format:checkwere not run locally, per the shared-machine load rule; CI covers them.Risk / follow-ups
Pending, where a dependency may have changed but evaluates equal, now notifies its moved consumers once. They re-read and get an unchanged value. That costs at most one extra render, only when a dependency moved between render and commit.derived$and scalar views.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches signal graph promotion on view-transition acceptance only; may trigger one extra re-read/render when a ready view was invalidated but the value is unchanged.
Overview
Fixes stale UI and reads when a held View Transition accepts a render that redeclared a
derived$whose new dependency changed while the update was staged.promoteDeclarationViewpreviously keptDirty/Pendinginvalidation only for pending declaration views (#1775). A ready view that was invalidated before acceptance was promoted with clean flags, so the canonical cell kept the old value. The change treats any evaluated view the same: copy invalidation flags onto the cell, bump revision when needed, and propagate to moved subscribers so they re-read the current definition.Adds
signals-staged-invalidationtests (pending and ready cases, dependency changes before/after acceptance, and flip-back-while-held) under mocked view transitions.Reviewed by Cursor Bugbot for commit b2dff75. Bugbot is set up for automated code reviews on this repo. Configure here.