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.
This commit is contained in:
silentoplayz 2025-10-24 08:53:51 -04:00 committed by Stoyan Zlatev
parent 594925219e
commit d9aa8a5ce4

View file

@ -108,7 +108,7 @@
source: _source, source: _source,
document: [document], document: [document],
metadata: metadata ? [metadata] : [], metadata: metadata ? [metadata] : [],
distances: distance !== undefined ? [distance] : undefined distances: distance !== undefined ? [distance] : []
}); });
} }
}); });