diff --git a/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte b/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte index 4a0d7d775da..09a1382af85 100644 --- a/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte +++ b/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte @@ -131,13 +131,16 @@ partialExplore, metricsSpec, ); - redirectUrl.search = getUpdatedUrlForExploreState( - exploreSpec, - timeControlsState, - defaultExplorePreset, - partialExplore, - $page.url.searchParams, - ); + if (shouldUpdateUrl) { + // if we added extra url params from sessionStorage then update the url + redirectUrl.search = getUpdatedUrlForExploreState( + exploreSpec, + timeControlsState, + defaultExplorePreset, + partialExplore, + $page.url.searchParams, + ); + } // update session store when back button was pressed. if (backButtonUsed) { updateExploreSessionStore( @@ -183,7 +186,8 @@ // when there are no params set, state will be state from config yaml and any additional initial state like bookmark initState = { ...exploreStateFromYAMLConfig, - ...(initExploreState ?? {}), + // if the url changed manually then do not load data from initState, which is home bookmark or shared url's state + ...(isManualUrlChange ? {} : (initExploreState ?? {})), }; shouldUpdateUrl = !!initExploreState; } else { @@ -247,6 +251,7 @@ const newUrl = u.toString(); if (!prevUrl || prevUrl === newUrl) return; + prevUrl = newUrl; // dashboard changed so we should update the url void goto(newUrl); // also update the session store