silverwolf-x/project / packages /next /src /client /components /errors /root-error-boundary.tsx
silverwolf-x's picture
download
raw
952 Bytes
'use client'
import React, { type JSX } from 'react'
import GracefulDegradeBoundary from './graceful-degrade-boundary'
import { ErrorBoundary, type ErrorBoundaryProps } from '../error-boundary'
import { isBot } from '../../../shared/lib/router/utils/is-bot'
const isBotUserAgent =
typeof window !== 'undefined' && isBot(window.navigator.userAgent)
export default function RootErrorBoundary({
children,
errorComponent,
errorStyles,
errorScripts,
}: ErrorBoundaryProps & { children: React.ReactNode }): JSX.Element {
if (isBotUserAgent) {
// Preserve existing DOM/HTML for bots to avoid replacing content with an error UI
// and to keep the original SSR output intact.
return <GracefulDegradeBoundary>{children}</GracefulDegradeBoundary>
}
return (
<ErrorBoundary
errorComponent={errorComponent}
errorStyles={errorStyles}
errorScripts={errorScripts}
>
{children}
</ErrorBoundary>
)
}

Xet Storage Details

Size:
952 Bytes
·
Xet hash:
490eab9fefb99dd5f4b7e87ae017dfa4dcb8e9c6ced6fd711dd6c40a847f85c8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.