-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat(app): add
experimental.missingSuspenseWithCSRBailout
(#…
- Loading branch information
Showing
30 changed files
with
387 additions
and
471 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
13 changes: 8 additions & 5 deletions
13
packages/next/src/client/components/bailout-to-client-rendering.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { BailoutToCSRError } from '../../shared/lib/lazy-dynamic/bailout-to-csr' | ||
import { throwWithNoSSR } from '../../shared/lib/lazy-dynamic/no-ssr-error' | ||
import { staticGenerationAsyncStorage } from './static-generation-async-storage.external' | ||
|
||
export function bailoutToClientRendering(reason: string): void | never { | ||
export function bailoutToClientRendering(): void | never { | ||
const staticGenerationStore = staticGenerationAsyncStorage.getStore() | ||
|
||
if (staticGenerationStore?.forceStatic) return | ||
if (staticGenerationStore?.forceStatic) { | ||
return | ||
} | ||
|
||
if (staticGenerationStore?.isStaticGeneration) | ||
throw new BailoutToCSRError(reason) | ||
if (staticGenerationStore?.isStaticGeneration) { | ||
throwWithNoSSR() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { DYNAMIC_ERROR_CODE } from '../../client/components/hooks-server-context' | ||
import { isNotFoundError } from '../../client/components/not-found' | ||
import { isRedirectError } from '../../client/components/redirect' | ||
import { isBailoutCSRError } from '../../shared/lib/lazy-dynamic/no-ssr-error' | ||
|
||
export const isDynamicUsageError = (err: any) => | ||
err.digest === DYNAMIC_ERROR_CODE || | ||
isNotFoundError(err) || | ||
isBailoutCSRError(err) || | ||
isRedirectError(err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
packages/next/src/shared/lib/lazy-dynamic/bailout-to-csr.ts
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
packages/next/src/shared/lib/lazy-dynamic/dynamic-bailout-to-csr.tsx
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
packages/next/src/shared/lib/lazy-dynamic/dynamic-no-ssr.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use client' | ||
|
||
import type React from 'react' | ||
import { throwWithNoSSR } from './no-ssr-error' | ||
|
||
type Child = React.ReactElement<any, any> | ||
|
||
export function NoSSR({ children }: { children: Child }): Child { | ||
if (typeof window === 'undefined') { | ||
throwWithNoSSR() | ||
} | ||
|
||
return children | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// This has to be a shared module which is shared between client component error boundary and dynamic component | ||
|
||
export const NEXT_DYNAMIC_NO_SSR_CODE = 'NEXT_DYNAMIC_NO_SSR_CODE' | ||
|
||
export function throwWithNoSSR() { | ||
const error = new Error(NEXT_DYNAMIC_NO_SSR_CODE) | ||
;(error as any).digest = NEXT_DYNAMIC_NO_SSR_CODE | ||
throw error | ||
} | ||
|
||
export function isBailoutCSRError(err: any) { | ||
return err?.digest === NEXT_DYNAMIC_NO_SSR_CODE | ||
} |
Oops, something went wrong.