From b55a8ab54fd20683d46fdbaa699f2e99a653ff41 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 10 Sep 2024 22:40:02 -0400 Subject: [PATCH] fix: Restore individual tabs to correct page post-login, closes #7467 --- app/hooks/useLastVisitedPath.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/hooks/useLastVisitedPath.tsx b/app/hooks/useLastVisitedPath.tsx index 0f4c211c78..f00172f24d 100644 --- a/app/hooks/useLastVisitedPath.tsx +++ b/app/hooks/useLastVisitedPath.tsx @@ -34,8 +34,11 @@ export function useLastVisitedPath(): [string, (path: string) => void] { * @param path The path to set as the post login path. */ export function setPostLoginPath(path: string) { + const key = "postLoginRedirectPath"; + if (isValidPostLoginRedirect(path)) { - setCookie("postLoginRedirectPath", path, { expires: 1 }); + setCookie(key, path, { expires: 1 }); + sessionStorage.setItem(key, path); } } @@ -49,7 +52,7 @@ export function usePostLoginPath() { const key = "postLoginRedirectPath"; const getter = React.useCallback(() => { - const path = getCookie(key); + const path = sessionStorage.getItem(key) || getCookie(key); if (path) { Logger.info("lifecycle", "Spending post login path", { path });