-
Notifications
You must be signed in to change notification settings - Fork 21
Fix React rendering errors to show 404 page instead of Hey Fernie page #4140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: app
Are you sure you want to change the base?
Changes from all commits
54b8392
2eaa557
570fa4d
4e789aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use client"; | ||
|
||
import { FernButton } from "@fern-docs/components/FernButton"; | ||
import GradientExclamation from "@fern-docs/components/GradientExclamation"; | ||
import { HiddenSidebar } from "@fern-docs/components/theming/HiddenSidebar"; | ||
import { useEffect } from "react"; | ||
|
||
import { NotFound404Tracker } from "@/components/analytics/NotFound404Tracker"; | ||
import ReturnHomeButton from "@/components/ReturnHomeButton"; | ||
|
||
export default function ErrorBoundary({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) { | ||
useEffect(() => { | ||
console.error(`[domain-error-boundary] ${JSON.stringify(error)}`); | ||
}, [error]); | ||
|
||
return ( | ||
<> | ||
<NotFound404Tracker /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error boundary incorrectly uses View Details📝 Patch Detailsdiff --git a/packages/fern-docs/bundle/src/app/[host]/[domain]/error.tsx b/packages/fern-docs/bundle/src/app/[host]/[domain]/error.tsx
index 996a4b0f3..707d9a88a 100644
--- a/packages/fern-docs/bundle/src/app/[host]/[domain]/error.tsx
+++ b/packages/fern-docs/bundle/src/app/[host]/[domain]/error.tsx
@@ -5,7 +5,7 @@ import GradientExclamation from "@fern-docs/components/GradientExclamation";
import { HiddenSidebar } from "@fern-docs/components/theming/HiddenSidebar";
import { useEffect } from "react";
-import { NotFound404Tracker } from "@/components/analytics/NotFound404Tracker";
+
import ReturnHomeButton from "@/components/ReturnHomeButton";
export default function ErrorBoundary({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
@@ -15,7 +15,6 @@ export default function ErrorBoundary({ error, reset }: { error: Error & { diges
return (
<>
- <NotFound404Tracker />
<HiddenSidebar />
<div className="flex h-[calc(100svh-var(--header-height)-6rem)] w-screen flex-col items-center justify-center gap-6">
<GradientExclamation />
AnalysisError boundary incorrectly tracks rendering errors as 404 events in analyticsWhat fails: ErrorBoundary in How to reproduce:
Result: All rendering errors tracked as 404 events, polluting 404 analytics and making it impossible to distinguish actual missing pages from component failures Expected: Error boundaries should not track analytics events, consistent with other error boundaries in the codebase (see |
||
<HiddenSidebar /> | ||
<div className="flex h-[calc(100svh-var(--header-height)-6rem)] w-screen flex-col items-center justify-center gap-6"> | ||
<GradientExclamation /> | ||
<div className="flex flex-col text-center"> | ||
<h1>We've encountered an error!</h1> | ||
<p className="text-(color:--grayscale-a9)">Please try again. If the problem persists, contact support.</p> | ||
</div> | ||
<div className="flex flex-col gap-3 sm:flex-row"> | ||
<FernButton intent="primary" onClick={reset}> | ||
Try again | ||
</FernButton> | ||
<ReturnHomeButton /> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
Uh oh!
There was an error while loading. Please reload this page.