Fix workspace-setup redirect loop after org creation

The JWT callback was optimized to only query the DB on sign-in or
explicit session update, but the middleware reads the JWT cookie which
was stale after org changes. Reverted to always refreshing org data in
the JWT callback (matching original behavior). Also switched workspace-
setup and onboarding completion to hard navigation to guarantee the
middleware re-evaluates with the latest JWT cookie.

Made-with: Cursor
This commit is contained in:
Randall Stillwell 2026-04-16 19:10:41 -05:00
parent bf92126cf5
commit 4db78b7176

View file

@ -126,8 +126,7 @@ export default function OnboardingPage() {
}
if (result.complete) {
await fetch("/api/auth/session");
router.replace("/");
window.location.href = "/";
return result;
}