Skip to content

NavigationBlockerAdapter

Defined in: packages/react/src/config/useFrameworkComponents.ts:39

Framework adapter capability for intercepting navigation away from a dirty edit view (decisions 1–2). @vexcms/react never imports a router — useUnsavedChangesGuard calls useBlocker unconditionally and the adapter decides how to intercept in-app link clicks and back/forward for its framework (unload is NOT this adapter’s job — useUnsavedChangesGuard registers beforeunload itself). @vexcms/next is the only implementation shipped in 0.1.0 (Step 8); a TanStack Start adapter would implement the same contract without touching @vexcms/react.

useBlocker(props): void

Defined in: packages/react/src/config/useFrameworkComponents.ts:51

Registers interception for the lifetime of the calling component, re-registering whenever when changes. A Rules-of-Hooks-safe hook: called every render regardless of when’s value.

Blocker props.

(proceed) => void

Called with a proceed callback instead of letting a blocked navigation through; calling proceed() lets that ONE navigation complete (a Leave click, or a released guard).

boolean

Whether navigation should currently be intercepted.

void