Skip to content

Commit

Permalink
handle redirect case
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Sep 20, 2022
1 parent 4efd391 commit 80ea14a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/next/client/components/hooks-server.ts
Expand Up @@ -26,7 +26,7 @@ if (process.env.NEXT_RUNTIME !== 'edge' && typeof window === 'undefined') {

function useStaticGenerationBailout(reason: string) {
const staticGenerationStore =
'getStore' in staticGenerationAsyncStorage
staticGenerationAsyncStorage && 'getStore' in staticGenerationAsyncStorage
? staticGenerationAsyncStorage?.getStore()
: staticGenerationAsyncStorage

Expand Down
6 changes: 5 additions & 1 deletion packages/next/export/worker.ts
Expand Up @@ -28,6 +28,7 @@ import RenderResult from '../server/render-result'
import isError from '../lib/is-error'
import { addRequestMeta } from '../server/request-meta'
import { normalizeAppPath } from '../shared/lib/router/utils/app-paths'
import { REDIRECT_ERROR_CODE } from '../client/components/redirect'

loadRequireHook()
const envConfig = require('../shared/lib/runtime-config')
Expand Down Expand Up @@ -419,7 +420,10 @@ export default async function exportPage({
)
}
} catch (err) {
if (!(err instanceof DynamicServerError)) {
if (
!(err instanceof DynamicServerError) &&
(err as any).code !== REDIRECT_ERROR_CODE
) {
throw err
}
}
Expand Down

0 comments on commit 80ea14a

Please sign in to comment.