fix: stop the analytics dashboard spinning when a custom range has no dates

This commit is contained in:
silentoplayz 2026-08-04 19:45:33 -04:00
parent 8dbbc206c5
commit 254e464b97
2 changed files with 11 additions and 3 deletions

View file

@ -160,9 +160,12 @@
loading = false;
};
$: awaitingCustomRange = selectedPeriod === 'custom' && !(customStart && customEnd);
// Reload when the period, group, or custom range changes.
// In custom mode, wait until both dates are set to avoid a half-specified query.
$: if (selectedPeriod === 'custom' ? customStart && customEnd : selectedPeriod) {
$: if (awaitingCustomRange) {
loading = false;
} else if (selectedPeriod) {
// reference customStart/customEnd so this block reruns when they change
customStart;
customEnd;
@ -281,7 +284,7 @@
/>
<!-- Summary stats -->
{#if !loading}
{#if !loading && !awaitingCustomRange}
<div class="flex gap-3 text-xs text-gray-500 dark:text-gray-400 px-0.5 pb-2">
<span
><span class="font-normal text-gray-900 dark:text-gray-300"
@ -343,6 +346,10 @@
<div class="my-10 flex justify-center">
<Spinner className="size-5" />
</div>
{:else if awaitingCustomRange}
<div class="my-10 text-center text-xs text-gray-500 dark:text-gray-400">
{$i18n.t('Select a start and end date to view analytics.')}
</div>
{:else}
<div class="grid md:grid-cols-2 gap-4">
<!-- Model Usage Table -->

View file

@ -2343,6 +2343,7 @@
"Select a pipeline url": "",
"Select a reranking model engine": "",
"Select a role": "",
"Select a start and end date to view analytics.": "",
"Select a theme": "",
"Select a tool": "",
"Select a voice": "",