From ce91071995cab05dbacdc76c1d0d1b875f8d2ea4 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 26 Sep 2024 17:35:13 -0400 Subject: [PATCH] fix: post login redirect path not correctly spent, closes #7662 --- app/hooks/useLastVisitedPath.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/hooks/useLastVisitedPath.tsx b/app/hooks/useLastVisitedPath.tsx index 41197e179e..e2580c681a 100644 --- a/app/hooks/useLastVisitedPath.tsx +++ b/app/hooks/useLastVisitedPath.tsx @@ -63,7 +63,7 @@ export function usePostLoginPath() { try { path = sessionStorage.getItem(key) || getCookie(key); } catch (e) { - // If the session storage is inaccessible, we can't do anything about it. + // Expected error if the session storage is full or inaccessible. } if (path) { @@ -72,6 +72,11 @@ export function usePostLoginPath() { // Remove the cookie once the app has been navigated to the post login path. We dont // do this immediately as React StrictMode will render multiple times. const cleanup = history.listen(() => { + try { + sessionStorage.removeItem(key); + } catch (e) { + // Expected error if the session storage is full or inaccessible. + } removeCookie(key); cleanup?.(); });