fix(signals): move-and-clear _optimisticNodes on transition merge#2892
Conversation
mergeTransitionState copied outgoing._optimisticNodes into the target without clearing the outgoing array. Since the global queue's arrays alias the active transition's after initTransition, the adoption pass in initTransition re-pushed the same entries into the target right after the merge — duplicating every node, compounding across repeated merges. Mirror the move-and-clear pattern already used for _affectsNodes. Repro: two overlapping actions with optimistic writes; when the first resumes and writes into a signal owned by the second's transition, the merged transition held the first action's optimistic node twice. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merging this PR will not alter performance
Comparing Footnotes
|
Co-authored-by: Cursor <cursoragent@cursor.com>
mergeTransitionState copied outgoing._optimisticNodes into the target without clearing the outgoing array. Since the global queue's arrays alias the active transition's after initTransition, the adoption pass in initTransition re-pushed the same entries into the target right after the merge — duplicating every node, compounding across repeated merges. Mirror the move-and-clear pattern already used for _affectsNodes.
Repro: two overlapping actions with optimistic writes; when the first resumes and writes into a signal owned by the second's transition, the merged transition held the first action's optimistic node twice.