Skip to content

AuthTransitionState

Defined in: packages/react/src/auth/AuthTransitionContext.tsx:8

The marker useAuthTransition returns.

beginTransition: (identity, options?) => void

Defined in: packages/react/src/auth/AuthTransitionContext.tsx:56

Called by the host app’s sign-in/sign-out entry points — the signOut wrapper (VexAdminAuthAdapterProvider’s signOut, called BEFORE the actual authClient.signOut(), so the marker is set with zero network latency) and a reactive watcher on authClient.useSession() (covers sign-in, and any other session-establishing flow, without needing a dedicated call site for each) — see each app’s providers/convex.tsx.

Pass the identity the NEXT settled page is expected to carry: the signed-in user’s _id for a sign-in, null for a sign-out.

string | null

boolean

Pass true from a call site that ALREADY triggers its own navigation for this exact transition (a same-tab sign-out’s signOut wrapper, which full-reloads the current page once the session clears) — useNextAuthTransitionRefresh (@vexcms/next) consumes this via consumeSkipRefresh to skip the ONE router.refresh() that transition would otherwise trigger, which — fired synchronously, long before the full reload’s own signOut() round trip resolves — raced it: the admin shell briefly re-rendered signed-out and the route guard redirected to the sign-in page, visible for a moment before the full reload finally took over. Omit (or pass false) for every OTHER call site — in particular the reactive authClient.useSession() watcher, which has no navigation of its own and is this hook’s whole reason to exist (another tab signing out, or a session dying while this tab sits idle).

void


confirmTransition: () => void

Defined in: packages/react/src/auth/AuthTransitionContext.tsx:71

Called by a list hook once it observes a page whose viewerId matches expectedIdentity — clears isTransitionPending for every other mounted list hook too.

void


consumeSkipRefresh: () => boolean

Defined in: packages/react/src/auth/AuthTransitionContext.tsx:65

Checks whether the MOST RECENT beginTransition call passed { skipRefresh: true }, clearing the flag either way (one-shot — each beginTransition call gets its own independent answer). Always false with no AuthTransitionProvider mounted.

boolean

true exactly once per { skipRefresh: true } transition.


expectedIdentity: string | null

Defined in: packages/react/src/auth/AuthTransitionContext.tsx:15

The identity every list hook currently trusts a live push against — VexApiAuth.user._id, or null for signed-out. Starts null (no provider, or no transition ever begun) and is only ever written by beginTransition.


isTransitionPending: boolean

Defined in: packages/react/src/auth/AuthTransitionContext.tsx:28

true from the moment beginTransition is called until a page whose viewerId matches expectedIdentity is observed by ANY mounted list hook (confirmTransition) — every mounted list hook shares this one flag, since they’re all driven by the SAME underlying auth change: one confirmation means the identity has genuinely settled everywhere.

false by default (including with no AuthTransitionProvider mounted at all — e.g. existing tests) — list hooks only start ignoring non-matching pushes while this is true; in the common/default case every push commits exactly as it always has.