From e27d8231e9d8fb590b7967151e82397e8e107216 Mon Sep 17 00:00:00 2001 From: Talal Sharabi Date: Sun, 15 Mar 2026 20:02:40 +0400 Subject: [PATCH] Fix login redirect: push router immediately and skip SWR revalidation After login, explicitly navigate to destination instead of relying on useEffect. Also skip SWR revalidation to prevent a race where the re-fetch overrides the mutated user data. Made-with: Cursor --- src/pages/login.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/login.tsx b/src/pages/login.tsx index 8cc49f98..4775bf5c 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -82,7 +82,8 @@ export default function Login({ destination = "/" }: { destination?: string }) { toast.success("You have been logged in!", { toastId: "login-successful", }); - mutateUser(response.data); + mutateUser(response.data, { revalidate: false }); + router.push(destination); }) .catch((e) => { if (e.response.status === 401) {