Skip to content

Commit d58a18f

Browse files
committed
fix(strong-mode): tag state-tuple args as stale in Effect Event deferred calls
staleValue only handled 'snapshot' and 'derived-state' kinds, letting a state-tuple passed from deferred code into an Effect Event keep its snapshot without the stale flag. snapshotBinding and bindTuplePattern then exposed the shared tuple.snapshot as a live capture, causing OCTANE_STRONG_STALE_STATE_UPDATE to be silently skipped for deferred pair[1](pair[0] + 1) patterns. Add state-tuple handling to staleValue so the tuple copy carries a stale snapshot, matching the scope-based rule this per-value tag replaced.
1 parent 10e89bd commit d58a18f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎packages/octane/src/compiler/strong-mode.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3796,9 +3796,11 @@ export function analyzeStrongMode(ast, source, filename, options = {}) {
37963796
}
37973797

37983798
function staleValue(value) {
3799-
return (value?.kind === 'snapshot' || value?.kind === 'derived-state') && value.stale !== true
3800-
? { ...value, stale: true }
3801-
: value;
3799+
if ((value?.kind === 'snapshot' || value?.kind === 'derived-state') && value.stale !== true)
3800+
return { ...value, stale: true };
3801+
if (value?.kind === 'state-tuple' && value.snapshot?.stale !== true)
3802+
return { ...value, snapshot: { ...value.snapshot, stale: true } };
3803+
return value;
38023804
}
38033805

38043806
function visitFresh(value, origin, phase, args) {

0 commit comments

Comments
 (0)