Skip to content

Commit bae80c8

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 3bdb571 commit bae80c8

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
@@ -25,16 +25,8 @@ export const usePagesDevOverlay = () => {
2525
}
2626
}, [dispatch])
2727

28-
const onComponentError = React.useCallback(
29-
(_error: Error, _componentStack: string | null) => {
30-
// TODO: special handling
31-
},
32-
[]
33-
)
34-
3528
return {
3629
state,
37-
onComponentError,
3830
dispatch,
3931
}
4032
}

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)