Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default async function middlewareSSRLoader(this: any) {
buildManifest,
reactLoadableManifest,
serverComponentManifest: ${isServerComponent} ? rscManifest : null,
isServerComponent: ${isServerComponent},
config: ${stringifiedConfig},
buildId: ${JSON.stringify(buildId)},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export function getRender({
buildManifest,
reactLoadableManifest,
serverComponentManifest,
isServerComponent,
config,
buildId,
}: {
Expand All @@ -39,7 +38,6 @@ export function getRender({
buildManifest: BuildManifest
reactLoadableManifest: ReactLoadableManifest
serverComponentManifest: any | null
isServerComponent: boolean
config: NextConfig
buildId: string
}) {
Expand Down Expand Up @@ -109,10 +107,6 @@ export function getRender({
const requestHandler = server.getRequestHandler()

return async function render(request: NextRequest) {
const { nextUrl: url } = request
const { searchParams } = url
const query = Object.fromEntries(searchParams)

// Preflight request
if (request.method === 'HEAD') {
// Hint the client that the matched route is a SSR page.
Expand All @@ -123,21 +117,6 @@ export function getRender({
})
}

const renderServerComponentData = isServerComponent
? query.__flight__ !== undefined
: false

const serverComponentProps =
isServerComponent && query.__props__
? JSON.parse(query.__props__)
: undefined

// Extend the render options.
server.updateRenderOpts({
renderServerComponentData,
serverComponentProps,
})

const extendedReq = new WebNextRequest(request)
const extendedRes = new WebNextResponse()
requestHandler(extendedReq, extendedRes)
Expand Down
19 changes: 11 additions & 8 deletions packages/next/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ export type RenderOptsPartial = {
resolvedUrl?: string
resolvedAsPath?: string
serverComponentManifest?: any
renderServerComponentData?: boolean
serverComponentProps?: any
distDir?: string
locale?: string
locales?: string[]
Expand Down Expand Up @@ -451,7 +449,6 @@ export async function renderToHTML(
getStaticPaths,
getServerSideProps,
serverComponentManifest,
serverComponentProps,
isDataReq,
params,
previewProps,
Expand Down Expand Up @@ -505,11 +502,17 @@ export async function renderToHTML(
return ''
}

let { renderServerComponentData } = renderOpts
if (isServerComponent && query.__flight__) {
renderServerComponentData = true
delete query.__flight__
}
let renderServerComponentData = isServerComponent
? query.__flight__ !== undefined
: false

const serverComponentProps =
isServerComponent && query.__props__
? JSON.parse(query.__props__ as string)
: undefined

delete query.__flight__
delete query.__props__

const callMiddleware = async (method: string, args: any[], props = false) => {
let results: any = props ? {} : []
Expand Down
4 changes: 0 additions & 4 deletions packages/next/server/web-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,4 @@ export default class NextWebServer extends BaseServer {
components: result,
}
}

public updateRenderOpts(renderOpts: Partial<BaseServer['renderOpts']>) {
Object.assign(this.renderOpts, renderOpts)
}
}