fix(ui): sidebar catalog counts follow global time range

useCatalog now accepts optional from/to query params and LayoutShell
threads the TopBar time range through, so the per-app exchange counts
shown in the sidebar align with the Exchanges tab window. Previously
the sidebar relied on the backend's 24h default — 73.5k in the sidebar
coexisted with 0 hits in a 1h Exchanges search, confusing users.

Other useCatalog callers stay on the default (no time range), matching
their existing behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-23 19:15:01 +02:00
parent 166568edea
commit b799d55835
2 changed files with 7 additions and 3 deletions

View File

@@ -361,7 +361,9 @@ function LayoutContent() {
const selectedEnv = useEnvironmentStore((s) => s.environment);
const setSelectedEnvRaw = useEnvironmentStore((s) => s.setEnvironment);
const { data: catalog } = useCatalog(selectedEnv);
const catalogFrom = timeRange.start.toISOString();
const catalogTo = timeRange.end.toISOString();
const { data: catalog } = useCatalog(selectedEnv, catalogFrom, catalogTo);
// Env is always required now (path-based endpoint). For cross-env "all agents"
// we'd need a separate flat endpoint; sidebar uses env-filtered list directly.
const { data: agents } = useAgents(); // env pulled from store internally