import { Link } from '@tanstack/react-router' import { isError } from 'lodash' import { ClientSideExceptionHandler } from './ClientSideExceptionHandler' import { InsertBeforeRemoveChildErrorHandler } from './InsertBeforeRemoveChildErrorHandler' import { useChunkLoadReload } from './useChunkLoadReload' import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' import { useRoutePattern } from '@/hooks/misc/useRoutePattern' import { BASE_PATH } from '@/lib/constants' export type FallbackProps = { error: unknown resetErrorBoundary: (...args: unknown[]) => void } export const GlobalErrorBoundaryState = ({ error, resetErrorBoundary }: FallbackProps) => { const routePattern = useRoutePattern() const checkIsError = isError(error) const largeLogo = useIsFeatureEnabled('branding:large_logo') // Render nothing rather than flash the error state while the reload is in // flight. The boundary's `onError` reloads on the first catch; the hook also // covers a later re-render that becomes eligible after `onError` already ran const { isReloading } = useChunkLoadReload(error) if (isReloading) return null const errorMessage = checkIsError ? error.message : '' const urlMessage = checkIsError ? `Path name: ${routePattern}\n\n${error?.stack}` : '' const isRemoveChildError = checkIsError ? errorMessage.includes("Failed to execute 'removeChild' on 'Node'") : false const isInsertBeforeError = checkIsError ? errorMessage.includes("Failed to execute 'insertBefore' on 'Node'") : false // Get Sentry issue ID from error if available const sentryIssueId = (!!error && typeof error === 'object' && (error as any).sentryId) ?? '' return (
Supabase
{isRemoveChildError || isInsertBeforeError ? ( ) : ( )}
) }