Skip to content

Commit a3ccfdb

Browse files
jribbinkclaude
andcommitted
fix: clone tx status objects in legacy polling to prevent shared reference bug
The legacy polling actor's SUBSCRIBE handler sends ctx.all() (its internal KVS object) by reference, and the POLL handler mutates it via ctx.merge(). When the new createObservable wrapper (introduced in #2258) stores this reference as `value` and later compares with isDiff(), the deepEqual check short-circuits on `a === b` (same object reference) and always returns false — so status updates are never delivered to subscribers. Fix: spread the objects before sending/broadcasting so consumers get their own copy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 961e5be commit a3ccfdb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/fcl-core/src/transaction/legacy-polling.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const makeHandlers = (opts = {}) => ({
5656
},
5757
[SUBSCRIBE]: (ctx, letter) => {
5858
ctx.subscribe(letter.from)
59-
ctx.send(letter.from, UPDATED, ctx.all())
59+
ctx.send(letter.from, UPDATED, {...ctx.all()})
6060
},
6161
[UNSUBSCRIBE]: (ctx, letter) => {
6262
ctx.unsubscribe(letter.from)
@@ -96,7 +96,7 @@ const makeHandlers = (opts = {}) => ({
9696
}
9797

9898
if (!isSealed(tx)) poll()
99-
if (isDiff(prevTx, tx)) ctx.broadcast(UPDATED, tx)
99+
if (isDiff(prevTx, tx)) ctx.broadcast(UPDATED, {...tx})
100100
ctx.merge(tx)
101101
},
102102
})

0 commit comments

Comments
 (0)