File tree Expand file tree Collapse file tree
packages/remix/src/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @clerk/remix ' : minor
3+ ---
4+
5+ Introduce ` V2_ClerkErrorBoundary ` to support ` v2_errorBoundary ` future flag
Original file line number Diff line number Diff line change 1+ import { isRouteErrorResponse , useRouteError } from '@remix-run/react' ;
2+ import React from 'react' ;
3+
4+ import { Interstitial } from './Interstitial' ;
5+
6+ /*
7+ * V2_ClerkErrorBoundary needs the `v2_errorBoundary` future flag to be enabled.
8+ */
9+ export function V2_ClerkErrorBoundary ( RootErrorBoundary ?: React . ComponentType ) {
10+ return ( ) => {
11+ const error = useRouteError ( ) ;
12+
13+ if ( isRouteErrorResponse ( error ) ) {
14+ const { __clerk_ssr_interstitial_html } = error ?. data ?. clerkState ?. __internal_clerk_state || { } ;
15+ if ( __clerk_ssr_interstitial_html ) {
16+ return < Interstitial html = { __clerk_ssr_interstitial_html } /> ;
17+ }
18+ }
19+
20+ if ( ! RootErrorBoundary ) {
21+ return undefined ;
22+ }
23+
24+ return < RootErrorBoundary /> ;
25+ } ;
26+ }
Original file line number Diff line number Diff line change 11export * from './RemixClerkProvider' ;
22export { ClerkApp } from './ClerkApp' ;
33export * from './ClerkCatchBoundary' ;
4+ export * from './V2_ClerkErrorBoundary' ;
45export { WithClerkState } from './types' ;
You can’t perform that action at this time.
0 commit comments