Skip to content

Commit

Permalink
fix(remix): Ensure interstitial is triggered on route transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
BRKalow committed Sep 25, 2023
1 parent 35f6f0c commit 2013f44
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/remix/src/client/ClerkErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ export function ClerkErrorBoundary(RootErrorBoundary?: React.ComponentType) {
if (isRouteErrorResponse(error)) {
const { __clerk_ssr_interstitial_html } = error?.data?.clerkState?.__internal_clerk_state || {};
if (__clerk_ssr_interstitial_html) {
/**
* In the (unlikely) case we trigger an interstitial during a client-side transition, we need to reload the page so the interstitial can properly trigger. Without a reload, the injected script tag does not get executed.
* Notably, this currently triggers for satellite domain syncing.
*/
if (typeof window !== 'undefined') {
window.location.reload();
return;
}

return <Interstitial html={__clerk_ssr_interstitial_html} />;
}
}
Expand Down

0 comments on commit 2013f44

Please sign in to comment.