Skip to content

Commit 5062d80

Browse files
authored
fix: Prevent dashboard infinite re-render (#1529)
Closes HDX-3117 # Summary This PR fixes a crash when loading or navigating away from the dashboard page. It occurred when a non-auto granularity was specified, and was caused by an infinite re-render loop due to continuously watching and resetting the granularity query parameter. ## Before https://github.com/user-attachments/assets/f2bd0b48-5292-48b6-b27c-f007e5faef06 ## After https://github.com/user-attachments/assets/3bcd635a-1d14-4530-b08b-c737984133eb
1 parent 2142734 commit 5062d80

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed
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+
fix: Prevent dashboard infinite re-render

packages/app/src/DBDashboardPage.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -650,11 +650,6 @@ function DBDashboardPage({ presetConfig }: { presetConfig?: Dashboard }) {
650650
whereLanguage: SearchConditionLanguage;
651651
}>({
652652
defaultValues: {
653-
granularity: 'auto',
654-
where: '',
655-
whereLanguage: 'lucene',
656-
},
657-
values: {
658653
granularity: granularity ?? 'auto',
659654
where: where ?? '',
660655
whereLanguage: (whereLanguage as SearchConditionLanguage) ?? 'lucene',
@@ -672,17 +667,10 @@ function DBDashboardPage({ presetConfig }: { presetConfig?: Dashboard }) {
672667
const [displayedTimeInputValue, setDisplayedTimeInputValue] =
673668
useState('Past 1h');
674669

675-
const {
676-
searchedTimeRange,
677-
// displayedTimeInputValue,
678-
// setDisplayedTimeInputValue,
679-
onSearch,
680-
onTimeRangeSelect,
681-
} = useNewTimeQuery({
670+
const { searchedTimeRange, onSearch, onTimeRangeSelect } = useNewTimeQuery({
682671
initialDisplayValue: 'Past 1h',
683672
initialTimeRange: defaultTimeRange,
684673
setDisplayedTimeInputValue,
685-
// showRelativeInterval: isLive,
686674
});
687675

688676
const {

0 commit comments

Comments
 (0)