From a3429a609e00d9efb6c8346d4d7ce0006d058e7e Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Fri, 17 Apr 2026 14:48:29 +0200 Subject: [PATCH] fix(ui): live-tail logs when time range is a relative preset Page 1 refetches were using the captured timeRange.end, so rows arriving after the initial render were outside the query window and never surfaced. When timeRange.preset is set (e.g. 'last 1h'), each fetch now advances 'to' to Date.now() so the poll picks up new rows. Absolute ranges are unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- ui/src/api/queries/logs.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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);