From 90e362398d87df8486c955d97592dc9255443aa7 Mon Sep 17 00:00:00 2001 From: UtkarshUsername Date: Fri, 30 Oct 2026 14:27:45 +0530 Subject: [PATCH] perf(client): avoid temporary arrays in inbox snapshots --- packages/client-runtime/src/state/threadInbox.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client-runtime/src/state/threadInbox.ts b/packages/client-runtime/src/state/threadInbox.ts index de9cd822398d0..43294c02a9b40 100644 --- a/packages/client-runtime/src/state/threadInbox.ts +++ b/packages/client-runtime/src/state/threadInbox.ts @@ -227,7 +227,8 @@ export function createInboxReturnTracker() { } } schedule(); - const observedWorking = new Map([...states].map(([key, state]) => [key, state.working])); + const observedWorking = new Map(); + states.forEach((state, key) => observedWorking.set(key, state.working)); const observedReturns = new Map(returns); return { isWorking: (thread) => observedWorking.get(keyOf(thread)) ?? isThreadWorking(thread),