middleware fix wip
This commit is contained in:
@@ -47,6 +47,18 @@ export class EnhancedErrorBoundary extends Component<Props, State> {
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error: Error): State {
|
||||
// Don't catch Next.js navigation errors (redirect, notFound, etc.)
|
||||
if (error && typeof error === 'object' && 'digest' in error) {
|
||||
const digest = (error as any).digest;
|
||||
if (typeof digest === 'string' && (
|
||||
digest.startsWith('NEXT_REDIRECT') ||
|
||||
digest.startsWith('NEXT_NOT_FOUND')
|
||||
)) {
|
||||
// Re-throw Next.js navigation errors so they can be handled properly
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
hasError: true,
|
||||
error,
|
||||
@@ -56,6 +68,18 @@ export class EnhancedErrorBoundary extends Component<Props, State> {
|
||||
}
|
||||
|
||||
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
|
||||
// Don't catch Next.js navigation errors (redirect, notFound, etc.)
|
||||
if (error && typeof error === 'object' && 'digest' in error) {
|
||||
const digest = (error as any).digest;
|
||||
if (typeof digest === 'string' && (
|
||||
digest.startsWith('NEXT_REDIRECT') ||
|
||||
digest.startsWith('NEXT_NOT_FOUND')
|
||||
)) {
|
||||
// Re-throw Next.js navigation errors so they can be handled properly
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to React error history
|
||||
const reactErrors = (window as any).__GRIDPILOT_REACT_ERRORS__ || [];
|
||||
reactErrors.push({
|
||||
|
||||
Reference in New Issue
Block a user