1- import { useSession } from "next-auth/react" ;
2- import { useRouter } from "next/navigation" ;
31import { useState } from "react" ;
42
53import { setShowNewOrgModalFlag } from "@calcom/features/ee/organizations/hooks/useWelcomeModal" ;
@@ -11,8 +9,6 @@ import { showToast } from "@calcom/ui/components/toast";
119import type { OnboardingState } from "../store/onboarding-store" ;
1210
1311export const useSubmitOnboarding = ( ) => {
14- const router = useRouter ( ) ;
15- const { update : updateSession } = useSession ( ) ;
1612 const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
1713 const [ error , setError ] = useState < string | null > ( null ) ;
1814 const flags = useFlagMap ( ) ;
@@ -80,8 +76,6 @@ export const useSubmitOnboarding = () => {
8076 // No checkout URL means billing is disabled (self-hosted flow)
8177 // Organization has already been created by the backend
8278 showToast ( "Organization created successfully!" , "success" ) ;
83- // Refresh session to get updated organization data
84- await updateSession ( ) ;
8579 // Set flag to show welcome modal after personal onboarding redirect
8680 setShowNewOrgModalFlag ( ) ;
8781 skipToPersonal ( resetOnboarding ) ;
@@ -98,7 +92,9 @@ export const useSubmitOnboarding = () => {
9892 const skipToPersonal = ( resetOnboarding : ( ) => void ) => {
9993 resetOnboarding ( ) ;
10094 const gettingStartedPath = flags [ "onboarding-v3" ] ? "/onboarding/personal/settings" : "/getting-started" ;
101- router . push ( gettingStartedPath ) ;
95+ // Use window.location.href for a full page reload to ensure JWT callback runs
96+ // without trigger="update", which will call autoMergeIdentities() and fetch org data
97+ window . location . href = gettingStartedPath ;
10298 } ;
10399
104100 return {
0 commit comments