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.
This commit is contained in:
Brandon Pereira 2025-11-04 11:59:15 -07:00 committed by GitHub
parent 43dfb3aaff
commit 24bf2b419d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---
bug fixes with relative time selection

View file

@ -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,

View file

@ -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);
}
}
}
}, [