import { Button } from "@follow/components/ui/button/index.js" import { captureException } from "@sentry/react" import { useEffect, useRef } from "react" import { isRouteErrorResponse, useNavigate, useRouteError } from "react-router" import { toast } from "sonner" import { removeAppSkeleton } from "~/lib/app" import { attachOpenInEditor } from "~/lib/dev" import { getNewIssueUrl } from "~/lib/issues" import { clearLocalPersistStoreData } from "~/store/utils/clear" import { PoweredByFooter } from "./PoweredByFooter" export function ErrorElement() { const error = useRouteError() const navigate = useNavigate() const message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error) const stack = error instanceof Error ? error.stack : null useEffect(() => { removeAppSkeleton() }, []) useEffect(() => { console.error("Error handled by React Router default ErrorBoundary:", error) captureException(error) }, [error]) const reloadRef = useRef(false) if ( message.startsWith("Failed to fetch dynamically imported module") && window.sessionStorage.getItem("reload") !== "1" ) { if (reloadRef.current) return null toast.info("Web app has been updated so it needs to be reloaded.") window.sessionStorage.setItem("reload", "1") window.location.reload() reloadRef.current = true return null } return (

Sorry, {APP_NAME} has encountered an error

{message}

{import.meta.env.DEV && stack ? (
          {attachOpenInEditor(stack)}
        
) : null}

{APP_NAME} has a temporary problem, click the button below to try reloading the app or another solution?

) } export const FeedbackIssue = (_props: { message: string stack: string | null | undefined error?: unknown }) => (

Still having this issue? Please give feedback in GitHub, thanks! Submit Issue

)