mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: Respect date range URL params on Services dashboard (#1594)
Closes HDX-3189 # Summary This PR fixes a bug that caused the services dashboard to reset to the default time range on each page load, rather than respecting the URL date range params. The cause was that a couple of `useEffects` were firing at page load, and submitting a new date range.
This commit is contained in:
parent
79398be73a
commit
5b252211a5
2 changed files with 16 additions and 8 deletions
5
.changeset/fair-pugs-melt.md
Normal file
5
.changeset/fair-pugs-melt.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@hyperdx/app": patch
|
||||
---
|
||||
|
||||
fix: Respect date range URL params on Services dashboard
|
||||
|
|
@ -1480,19 +1480,22 @@ function ServicesDashboardPage() {
|
|||
isLive,
|
||||
});
|
||||
|
||||
const onSubmit = useCallback(() => {
|
||||
onSearch(displayedTimeInputValue);
|
||||
handleSubmit(values => {
|
||||
setAppliedConfigParams(values);
|
||||
})();
|
||||
}, [handleSubmit, setAppliedConfigParams, onSearch, displayedTimeInputValue]);
|
||||
const onSubmit = useCallback(
|
||||
(submitTime: boolean = true) => {
|
||||
if (submitTime) onSearch(displayedTimeInputValue);
|
||||
handleSubmit(values => {
|
||||
setAppliedConfigParams(values);
|
||||
})();
|
||||
},
|
||||
[handleSubmit, setAppliedConfigParams, onSearch, displayedTimeInputValue],
|
||||
);
|
||||
|
||||
// Auto-submit when source changes
|
||||
// Note: do not include appliedConfig.source in the deps,
|
||||
// to avoid infinite render loops when navigating away from the page
|
||||
useEffect(() => {
|
||||
if (sourceId && sourceId != previousSourceId) {
|
||||
onSubmit();
|
||||
onSubmit(false);
|
||||
}
|
||||
}, [sourceId, onSubmit, previousSourceId]);
|
||||
|
||||
|
|
@ -1501,7 +1504,7 @@ function ServicesDashboardPage() {
|
|||
// to avoid infinite render loops when navigating away from the page
|
||||
useEffect(() => {
|
||||
if (service != previousService) {
|
||||
onSubmit();
|
||||
onSubmit(false);
|
||||
}
|
||||
}, [service, onSubmit, previousService]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue