From 24bf2b419d044e07a99cf611a9470231d5c0ca73 Mon Sep 17 00:00:00 2001 From: Brandon Pereira Date: Tue, 4 Nov 2025 11:59:15 -0700 Subject: [PATCH] fix state issues with relative time input not matching reality (#1320) Fix issues where input state became out of sync in certain edge cases with relative time **Before** (Demo Video): https://github.com/user-attachments/assets/5f7b92f1-1dcd-413d-bca1-092d4e4bc360 **After**: issues are not observed. --- .changeset/thin-apricots-hunt.md | 5 +++++ packages/app/src/DBSearchPage.tsx | 2 +- packages/app/src/timeQuery.ts | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/thin-apricots-hunt.md diff --git a/.changeset/thin-apricots-hunt.md b/.changeset/thin-apricots-hunt.md new file mode 100644 index 00000000..063a3c87 --- /dev/null +++ b/.changeset/thin-apricots-hunt.md @@ -0,0 +1,5 @@ +--- +"@hyperdx/app": patch +--- + +bug fixes with relative time selection diff --git a/packages/app/src/DBSearchPage.tsx b/packages/app/src/DBSearchPage.tsx index 5fe5720f..e179d440 100644 --- a/packages/app/src/DBSearchPage.tsx +++ b/packages/app/src/DBSearchPage.tsx @@ -1030,7 +1030,7 @@ function DBSearchPage() { } // we only want this to run on initial mount // eslint-disable-next-line react-hooks/exhaustive-deps - }, [updateRelativeTimeInputValue, isReady]); + }, [updateRelativeTimeInputValue, searchedConfig.source, isReady]); useLiveUpdate({ isLive, diff --git a/packages/app/src/timeQuery.ts b/packages/app/src/timeQuery.ts index 899b6edc..8e7b2f2f 100644 --- a/packages/app/src/timeQuery.ts +++ b/packages/app/src/timeQuery.ts @@ -479,7 +479,11 @@ export function useNewTimeQuery({ setSearchedTimeRange(initialTimeRange); const dateRangeStr = dateRangeToString(initialTimeRange, isUTC); if (updateInput !== false) { - _setDisplayedTimeInputValue(initialDisplayValue ?? dateRangeStr); + if (!showRelativeInterval) { + _setDisplayedTimeInputValue(dateRangeStr); + } else { + _setDisplayedTimeInputValue(initialDisplayValue ?? dateRangeStr); + } } } }, [