From cfd587ed2a385b30bd48409b4dcc1fb89416d9b4 Mon Sep 17 00:00:00 2001 From: Vedant Mahajan Date: Mon, 13 Apr 2026 03:49:34 +0530 Subject: [PATCH] perf: scope message equality check to content+parts instead of full object (#842) --- apps/web/stores/chat.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/stores/chat.ts b/apps/web/stores/chat.ts index 7df867b0..456217b7 100644 --- a/apps/web/stores/chat.ts +++ b/apps/web/stores/chat.ts @@ -27,9 +27,9 @@ export function areUIMessageArraysEqual( return false } - // Compare the entire message using JSON serialization as a fallback - // This handles all properties including parts, toolInvocations, etc. - if (JSON.stringify(msgA) !== JSON.stringify(msgB)) { + if (msgA.content !== msgB.content) return false + + if (JSON.stringify(msgA.parts) !== JSON.stringify(msgB.parts)) { return false } }