Skip to content

Commit 24bf2b4

Browse files
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.
1 parent 43dfb3a commit 24bf2b4

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.changeset/thin-apricots-hunt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
bug fixes with relative time selection

packages/app/src/DBSearchPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ function DBSearchPage() {
10301030
}
10311031
// we only want this to run on initial mount
10321032
// eslint-disable-next-line react-hooks/exhaustive-deps
1033-
}, [updateRelativeTimeInputValue, isReady]);
1033+
}, [updateRelativeTimeInputValue, searchedConfig.source, isReady]);
10341034

10351035
useLiveUpdate({
10361036
isLive,

packages/app/src/timeQuery.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,11 @@ export function useNewTimeQuery({
479479
setSearchedTimeRange(initialTimeRange);
480480
const dateRangeStr = dateRangeToString(initialTimeRange, isUTC);
481481
if (updateInput !== false) {
482-
_setDisplayedTimeInputValue(initialDisplayValue ?? dateRangeStr);
482+
if (!showRelativeInterval) {
483+
_setDisplayedTimeInputValue(dateRangeStr);
484+
} else {
485+
_setDisplayedTimeInputValue(initialDisplayValue ?? dateRangeStr);
486+
}
483487
}
484488
}
485489
}, [

0 commit comments

Comments
 (0)