Skip to content

Commit

Permalink
refactor: fix navigations
Browse files Browse the repository at this point in the history
  • Loading branch information
Syed-Ali-Abbas-Zaidi committed Sep 7, 2023
1 parent f6e587c commit 1b63ce1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/course-home/outline-tab/OutlineTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ const OutlineTab = ({ intl }) => {
// Deleting the course_start query param as it only needs to be set once
// whenever passed in query params.
currentParams.delete('start_course');
navigate(`?${currentParams.toString()}`, { replace: true });
navigate({
pathname: location.pathname,
search: `?${currentParams.toString()}`,
replace: true,
});
}
}, [location.search]);

Expand Down
2 changes: 1 addition & 1 deletion src/decode-page-route/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const DecodePageRoute = ({ children }) => {

// if the url get decoded, reroute to the decoded url
if (newUrl !== pathname) {
return <Navigate to={newUrl} />;
return <Navigate to={newUrl} replace />;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/generic/CourseAccessErrorPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const CourseAccessErrorPage = ({ intl }) => {
);
}
if (courseStatus === LOADED) {
navigate(`/redirect/home/${courseId}`);
navigate(`/redirect/home/${courseId}`, { replace: true });
}
return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/tab-page/TabPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const TabPage = ({ intl, ...props }) => {
if (courseStatus === 'denied') {
const redirectUrl = getAccessDeniedRedirectUrl(courseId, activeTabSlug, courseAccess, start);
if (redirectUrl) {
return (<Navigate to={redirectUrl} />);
return (<Navigate to={redirectUrl} replace />);
}
}

Expand Down

0 comments on commit 1b63ce1

Please sign in to comment.