Skip to content

Commit

Permalink
App router migration error boundary component (#1121)
Browse files Browse the repository at this point in the history
* Add basic Root Layout

* Add metadata

* Add reference included by next

* Add comment to explain the default meta tags

* Add public testing page to check the migration

* Remove non required file

* Make error boundary client component

* Add ErrorBoundary component to root layout

* Create app router error route test page

---------

Co-authored-by: eleanorreem <[email protected]>
  • Loading branch information
boodland and eleanorreem committed Oct 8, 2024
1 parent 604f4e8 commit 9c6bb43
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/error-route-test/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use client';

export default function Page() {
setTimeout(() => {
throw new Error('An Error');
}, 1000);
return <div>ERROR TESTING PAGE</div>;
}
3 changes: 2 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import GoogleTagManagerScript from '../components/head/GoogleTagManagerScript';
import ErrorBoundary from '../components/layout/ErrorBoundary';
import rootMetadata from './rootMetadata';
import RollbarScript from '../components/head/RollbarScript';

Expand All @@ -20,7 +21,7 @@ export default function RootLayout({
*/}
<GoogleTagManagerScript />
<RollbarScript />
{children}
<ErrorBoundary>{children}</ErrorBoundary>
</body>
</html>
);
Expand Down
2 changes: 2 additions & 0 deletions components/layout/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { Alert, Snackbar } from '@mui/material';
import { Component, ErrorInfo, ReactNode } from 'react';

Expand Down

0 comments on commit 9c6bb43

Please sign in to comment.