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
parent 267794638c
commit 7222a9aef6

View file

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