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

Merged
merged 11 commits into from
May 14, 2025

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.

@ijjk ijjk added create-next-app Related to our CLI tool for quickly starting a new Next.js application. examples Issue was opened via the examples template. Font (next/font) Related to Next.js Font Optimization. Rspack tests labels May 14, 2025
Copy link

vercel bot commented May 14, 2025

Notifying the following users due to files changed in this PR based on this repo's notify modifiers:

@timneutkens, @ijjk, @shuding, @huozhi:

packages/next/src/server/config.ts

@ijjk ijjk added Turbopack Related to Turbopack with Next.js. type: next labels May 14, 2025
feedthejim and others added 10 commits May 14, 2025 08:01
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>
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>
@feedthejim feedthejim force-pushed the feedthejim/add-error-graceful-docs branch from 49edc53 to 30970cd Compare May 14, 2025 15:02
Copy link

changeset-bot bot commented May 14, 2025

⚠️ No Changeset found

Latest commit: 9efe611

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@feedthejim feedthejim merged commit 0dcee14 into canary May 14, 2025
69 checks passed
@feedthejim feedthejim deleted the feedthejim/add-error-graceful-docs branch May 14, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-next-app Related to our CLI tool for quickly starting a new Next.js application. created-by: Next.js team PRs by the Next.js team. Documentation Related to Next.js' official documentation. examples Issue was opened via the examples template. Font (next/font) Related to Next.js Font Optimization. Rspack tests Turbopack Related to Turbopack with Next.js. type: next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants