Skip to content

Commit 7e8f8b5

Browse files
committed
fix: update navigation logic in useCloudPlan to ensure proper URL handling
- Modified the navigate function to include the replace option, improving user experience by preventing unnecessary entries in the browser history when navigating with cloud mode parameters.
1 parent 55c73f6 commit 7e8f8b5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/shared/useCloudPlan.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ export const useCloudPlanNavigate = () => {
7070
const cloudModeFromSession = sessionStorage.getItem(CLOUD_MODE_KEY);
7171
const cloudMode = searchParams.get(CLOUD_MODE_KEY) || cloudModeFromSession;
7272

73-
if (!!cloudMode && cloudMode !== "dedicated") {
73+
if (
74+
!!cloudMode &&
75+
cloudMode !== "dedicated" &&
76+
!searchParams.get(CLOUD_MODE_KEY)
77+
) {
7478
navigate(
7579
`${location.pathname}?${CLOUD_MODE_KEY}=${cloudMode}${
7680
location.hash ? location.hash : ""
77-
}`
81+
}`,
82+
{ replace: true }
7883
);
7984
}
8085
}, []);

0 commit comments

Comments
 (0)