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

@@ -38,14 +38,16 @@ export interface CatalogApp {
deployment: DeploymentSummary | null;
}
export function useCatalog(environment?: string) {
export function useCatalog(environment?: string, from?: string, to?: string) {
const refetchInterval = useRefreshInterval(15_000);
return useQuery({
queryKey: ['catalog', environment],
queryKey: ['catalog', environment, from, to],
queryFn: async () => {
const token = useAuthStore.getState().accessToken;
const params = new URLSearchParams();
if (environment) params.set('environment', environment);
if (from) params.set('from', from);
if (to) params.set('to', to);
const qs = params.toString();
const res = await fetch(`${config.apiBaseUrl}/catalog${qs ? `?${qs}` : ''}`, {
headers: {