Skip to content

Commit ce8712d

Browse files
committed
[dev-overlay] Remove unused onError in /pages
Every implementation is a no-op and we don't have any plans. Can use the same pattern as App Router when we need it.
1 parent c3427fe commit ce8712d

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

packages/next/src/client/components/react-dev-overlay/pages/hooks.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,8 @@ export const usePagesDevOverlay = () => {
2727
}
2828
}, [dispatch])
2929

30-
const onComponentError = React.useCallback(
31-
(_error: Error, _componentStack: string | null) => {
32-
// TODO: special handling
33-
},
34-
[]
35-
)
36-
3730
return {
3831
state,
39-
onComponentError,
4032
dispatch,
4133
}
4234
}

packages/next/src/client/components/react-dev-overlay/pages/pages-dev-overlay-error-boundary.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react'
22

33
type PagesDevOverlayErrorBoundaryProps = {
44
children?: React.ReactNode
5-
onError: (error: Error, componentStack: string | null) => void
65
}
76
type PagesDevOverlayErrorBoundaryState = { error: Error | null }
87

@@ -16,13 +15,7 @@ export class PagesDevOverlayErrorBoundary extends React.PureComponent<
1615
return { error }
1716
}
1817

19-
componentDidCatch(
20-
error: Error,
21-
// Loosely typed because it depends on the React version and was
22-
// accidentally excluded in some versions.
23-
errorInfo?: { componentStack?: string | null }
24-
) {
25-
this.props.onError(error, errorInfo?.componentStack || null)
18+
componentDidCatch(error: Error) {
2619
this.setState({ error })
2720
}
2821

packages/next/src/client/components/react-dev-overlay/pages/pages-dev-overlay.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ interface PagesDevOverlayProps {
1212
}
1313

1414
export function PagesDevOverlay({ children }: PagesDevOverlayProps) {
15-
const { state, dispatch, onComponentError } = usePagesDevOverlay()
15+
const { state, dispatch } = usePagesDevOverlay()
1616

1717
return (
1818
<>
19-
<PagesDevOverlayErrorBoundary onError={onComponentError}>
19+
<PagesDevOverlayErrorBoundary>
2020
{children ?? null}
2121
</PagesDevOverlayErrorBoundary>
2222

0 commit comments

Comments
 (0)