diff --git a/ui/src/api/queries/logs.ts b/ui/src/api/queries/logs.ts index 982ab4f0..0dfc8e5d 100644 --- a/ui/src/api/queries/logs.ts +++ b/ui/src/api/queries/logs.ts @@ -184,6 +184,10 @@ export function useInfiniteApplicationLogs( const useTimeRange = !args.exchangeId; const fromIso = useTimeRange ? timeRange.start.toISOString() : undefined; const toIso = useTimeRange ? timeRange.end.toISOString() : undefined; + // Relative presets (e.g. "last 1h") should live-tail: each fetch advances + // `to` to "now" so new rows that arrive after the page was first rendered + // show up on refetch. Absolute ranges keep their captured `to`. + const isLiveRange = useTimeRange && !!timeRange.preset; const sortedSources = (args.sources ?? []).slice().sort(); const sortedLevels = (args.levels ?? []).slice().sort(); @@ -217,7 +221,8 @@ export function useInfiniteApplicationLogs( if (sourcesParam) qp.set('source', sourcesParam); if (levelsParam) qp.set('level', levelsParam); if (fromIso) qp.set('from', fromIso); - if (toIso) qp.set('to', toIso); + const effectiveTo = isLiveRange ? new Date().toISOString() : toIso; + if (effectiveTo) qp.set('to', effectiveTo); if (cursor) qp.set('cursor', cursor); qp.set('limit', String(pageSize)); qp.set('sort', sort);