From 7222a9aef6f124d47d6d91193b6b28adf82f922f Mon Sep 17 00:00:00 2001 From: silentoplayz Date: Fri, 24 Oct 2025 08:53:51 -0400 Subject: [PATCH] fix: prevent UI freeze by initializing distances array Fixes a bug where the UI would freeze when processing citation sources with mixed distance metrics. The `Citations.svelte` component was attempting to call `.push()` on an `undefined` `distances` array. This happened when the first document for a source had no distance value, but a subsequent document for the same source did. This patch ensures the `distances` array is always initialized as an empty array `[]` instead of `undefined`, preventing the `TypeError` and resolving the UI freeze. --- src/lib/components/chat/Messages/Citations.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/chat/Messages/Citations.svelte b/src/lib/components/chat/Messages/Citations.svelte index 8fe7d2dd27..0da0e9c0aa 100644 --- a/src/lib/components/chat/Messages/Citations.svelte +++ b/src/lib/components/chat/Messages/Citations.svelte @@ -108,7 +108,7 @@ source: _source, document: [document], metadata: metadata ? [metadata] : [], - distances: distance !== undefined ? [distance] : undefined + distances: distance !== undefined ? [distance] : [] }); } });