Skip to content

Commit

Permalink
Fix redirect loop in certain cases (#6317)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaHegde authored Jan 1, 2025
1 parent c79d9a5 commit 9fdb50b
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,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(
Expand Down Expand Up @@ -187,7 +190,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 {
Expand Down Expand Up @@ -255,6 +259,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
Expand Down

1 comment on commit 9fdb50b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.