From 4db8f009bff1fcc3d5462d39b8aaf4580d1f146e Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Fri, 15 Nov 2024 18:43:05 +0100 Subject: [PATCH] read status from error --- .../components/http-access-fallback/error-boundary.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/next/src/client/components/http-access-fallback/error-boundary.tsx b/packages/next/src/client/components/http-access-fallback/error-boundary.tsx index 3499ce58665fa..cf5c39079f6ec 100644 --- a/packages/next/src/client/components/http-access-fallback/error-boundary.tsx +++ b/packages/next/src/client/components/http-access-fallback/error-boundary.tsx @@ -14,7 +14,10 @@ import React, { useContext } from 'react' import { useUntrackedPathname } from '../navigation-untracked' -import { isHTTPAccessFallbackError } from './http-access-fallback' +import { + getAccessFallbackHTTPStatus, + isHTTPAccessFallbackError, +} from './http-access-fallback' import { warnOnce } from '../../../shared/lib/utils/warn-once' import { MissingSlotContext } from '../../../shared/lib/app-router-context.shared-runtime' @@ -79,7 +82,7 @@ class HTTPAccessFallbackErrorBoundary extends React.Component< static getDerivedStateFromError(error: any) { if (isHTTPAccessFallbackError(error)) { return { - triggeredStatus: HTTPErrorStatus.NOT_FOUND, + triggeredStatus: getAccessFallbackHTTPStatus(error), } } // Re-throw if error is not for 404