@@ -98,6 +98,7 @@ export function useMachineOnboardingState({
9898 const [ evaluatedPubkey , setEvaluatedPubkey ] = React . useState < string | null > (
9999 null ,
100100 ) ;
101+ const continuingPubkeyRef = React . useRef < string | null > ( null ) ;
101102 const startupPubkeyRef = React . useRef < string | null > ( null ) ;
102103 const [ bootedLost , setBootedLost ] = React . useState ( false ) ;
103104 const [ bootedLocked , setBootedLocked ] = React . useState ( false ) ;
@@ -157,6 +158,10 @@ export function useMachineOnboardingState({
157158 [ currentPubkey ] ,
158159 ) ;
159160
161+ const continueWithIdentity = React . useCallback ( ( pubkey : string ) => {
162+ continuingPubkeyRef . current = pubkey ;
163+ } , [ ] ) ;
164+
160165 const reopen = React . useCallback ( ( ) => {
161166 clearMachineOnboardingCompletion ( currentPubkey ) ;
162167 setCompletedPubkey ( ( pubkey ) => ( pubkey === currentPubkey ? null : pubkey ) ) ;
@@ -188,7 +193,12 @@ export function useMachineOnboardingState({
188193 identityQuery . fetchStatus === "fetching" ,
189194 ) ||
190195 ! currentPubkey ||
191- ( ! hasCompletedCurrentPubkey && evaluatedPubkey !== currentPubkey )
196+ // Imported identities are published before the flow can advance to setup.
197+ // Keep that explicitly requested identity switch in onboarding; only the
198+ // startup identity needs the one-render evaluation gate above.
199+ ( ! hasCompletedCurrentPubkey &&
200+ evaluatedPubkey !== currentPubkey &&
201+ continuingPubkeyRef . current !== currentPubkey )
192202 ) {
193203 stage = "blocking" ;
194204 } else if ( identityLost || ! hasCompletedCurrentPubkey ) {
@@ -199,6 +209,7 @@ export function useMachineOnboardingState({
199209
200210 return {
201211 complete,
212+ continueWithIdentity,
202213 currentPubkey,
203214 identityLost,
204215 queryClient,
0 commit comments