Skip to content

Commit

Permalink
fix react mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Dec 2, 2022
1 parent aff8bd0 commit 3dc3aba
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/next/client/app-index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createFromReadableStream } from 'next/dist/compiled/react-server-dom-we

import { HeadManagerContext } from '../shared/lib/head-manager-context'
import { GlobalLayoutRouterContext } from '../shared/lib/app-router-context'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/dynamic'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/no-ssr-error'

/// <reference types="react-dom/experimental" />

Expand Down
2 changes: 1 addition & 1 deletion packages/next/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
PathnameContextProviderAdapter,
} from '../shared/lib/router/adapters'
import { SearchParamsContext } from '../shared/lib/hooks-client-context'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/dynamic'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/no-ssr-error'

/// <reference types="react-dom/experimental" />

Expand Down
25 changes: 16 additions & 9 deletions packages/next/export/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { normalizeAppPath } from '../shared/lib/router/utils/app-paths'
import { REDIRECT_ERROR_CODE } from '../client/components/redirect'
import { DYNAMIC_ERROR_CODE } from '../client/components/hooks-server-context'
import { NOT_FOUND_ERROR_CODE } from '../client/components/not-found'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/dynamic'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/no-ssr-error'

loadRequireHook()

Expand Down Expand Up @@ -451,15 +451,22 @@ export default async function exportPage({
try {
await promises.access(ampHtmlFilepath)
} catch (_) {
let ampRenderResult
// make sure it doesn't exist from manual mapping
let ampRenderResult = await renderMethod(
req,
res,
page,
// @ts-ignore
{ ...query, amp: '1' },
curRenderOpts as any
)
try {
ampRenderResult = await renderMethod(
req,
res,
page,
// @ts-ignore
{ ...query, amp: '1' },
curRenderOpts as any
)
} catch (err: any) {
if (err.digest !== NEXT_DYNAMIC_NO_SSR_CODE) {
throw err
}
}

const ampHtml = ampRenderResult
? ampRenderResult.toUnchunkedString()
Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { REDIRECT_ERROR_CODE } from '../client/components/redirect'
import { RequestCookies } from './web/spec-extension/cookies'
import { DYNAMIC_ERROR_CODE } from '../client/components/hooks-server-context'
import { NOT_FOUND_ERROR_CODE } from '../client/components/not-found'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/dynamic'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/no-ssr-error'
import { HeadManagerContext } from '../shared/lib/head-manager-context'
import { Writable } from 'stream'
import stringHash from 'next/dist/compiled/string-hash'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import {
} from '../shared/lib/router/adapters'
import { AppRouterContext } from '../shared/lib/app-router-context'
import { SearchParamsContext } from '../shared/lib/hooks-client-context'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/dynamic'
import { NEXT_DYNAMIC_NO_SSR_CODE } from '../shared/lib/no-ssr-error'

let tryGetPreviewData: typeof import('./api-utils/node').tryGetPreviewData
let warn: typeof import('../build/output/log').warn
Expand Down
6 changes: 3 additions & 3 deletions packages/next/shared/lib/dynamic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export function noSSR<P = {}>(

return () => (
<Suspense fallback={fallback}>
<DynamicBoundary>
<NoSSRComponent />
</DynamicBoundary>
<NoSSRComponent />
{/* <DynamicBoundary>
</DynamicBoundary> */}
</Suspense>
)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/next/shared/lib/loadable-context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import React from 'react'

type CaptureFn = (moduleName: string) => void
Expand Down
4 changes: 0 additions & 4 deletions test/.stats-app/stats-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ module.exports = {
module.exports = {
experimental: {
appDir: true,
// remove after next stable release (current v12.3.1)
serverComponents: true,
},
generateBuildId: () => 'BUILD_ID',
webpack(config) {
Expand All @@ -103,8 +101,6 @@ module.exports = {
module.exports = {
experimental: {
appDir: true,
// remove after next stable relase (current v12.3.1)
serverComponents: true,
},
generateBuildId: () => 'BUILD_ID'
}
Expand Down

0 comments on commit 3dc3aba

Please sign in to comment.