Skip to content

Commit

Permalink
Be explicit about server components used in client rb error boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
matux committed Mar 8, 2024
1 parent 77b6fc7 commit 6ad5ccb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions examples/nextjs-approuter/src/app/callback.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use server';

import React from 'react';

export default async function Callback() {
console.log('an exception was sent to rollbar');
}
7 changes: 7 additions & 0 deletions examples/nextjs-approuter/src/app/fallback.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use server';

import React from 'react';

export default async function Fallback() {
return <p style={{ color: 'red' }}>Oops, there was an error.</p>;
}
8 changes: 4 additions & 4 deletions examples/nextjs-approuter/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import './globals.css';
import { Provider, ErrorBoundary } from '@rollbar/react';
import Fallback from './fallback';
import Callback from './callback';

const inter = Inter({ subsets: ['latin'] });

Expand Down Expand Up @@ -38,11 +40,9 @@ export default function RootLayout({
<ErrorBoundary
level="critical"
errorMessage="example error boundary message"
fallbackUI={() => (
<p style={{ color: 'red' }}>Oops, there was an error.</p>
)}
fallbackUI={Fallback}
extra={{ more: 'data' }}
callback={() => console.log('an exception was sent to rollbar')}
callback={Callback}
>
{children}
</ErrorBoundary>
Expand Down

0 comments on commit 6ad5ccb

Please sign in to comment.