From 3d6a100f79917566a6e3b02c281601ce2a31f5f5 Mon Sep 17 00:00:00 2001 From: ved015 Date: Thu, 9 Apr 2026 20:27:14 +0530 Subject: [PATCH] perf: scope message equality check to content+parts instead of full object --- 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 7df867b02..456217b7f 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 } }