Skip to content

docs: add graceful error boundary example #77781

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

Open
wants to merge 5 commits into
base: canary
Choose a base branch
from

Conversation

feedthejim
Copy link
Contributor

This adds an example in the documentation for the errors page for a graceful error boundary in Next.js.

@ijjk ijjk added created-by: Next.js team PRs by the Next.js team. Documentation Related to Next.js' official documentation. labels Apr 3, 2025

The `GracefullyDegradingErrorBoundary` is a custom error boundary that captures and preserves the current HTML before an error occurs. If a rendering error happens, it re-renders the captured HTML statically and displays a persistent notification bar to inform the user.

```tsx filename="app/dashboard/error.tsx" switcher
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like if you are using nested error.tsx, you might as well go the extra mile and implement some fallback UI when an error happens.

I see this being more useful as a recipe for global-error.

feedthejim and others added 2 commits April 3, 2025 08:24
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
created-by: Next.js team PRs by the Next.js team. Documentation Related to Next.js' official documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants