diff --git a/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte b/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte index 4a0d7d775da..8730fdc2dfd 100644 --- a/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte +++ b/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte @@ -160,6 +160,8 @@ } prevUrl = redirectUrl.toString(); + // using `replaceState` directly messes up the navigation entries, + // `from` and `to` have the old url before being replaced in `afterNavigate` calls leading to incorrect handling. void goto(redirectUrl, { replaceState: true, state: $page.state, @@ -194,7 +196,11 @@ }; } - await waitUntil(() => !timeRangeSummaryIsLoading); + // time range summary query has `enabled` based on `metricsSpec.timeDimension` + // isLoading will never be true when the query is disabled, so we need this check before waiting for it. + if (metricsSpec.timeDimension) { + await waitUntil(() => !timeRangeSummaryIsLoading); + } metricsExplorerStore.init(exploreName, initState); timeControlsState ??= getTimeControlState( metricsSpec,