Unverified Commit 2cf6696f authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Merge rsc queries handling (#35545)

Co-authored-by: 's avatarkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent 9fef0d55
...@@ -56,7 +56,6 @@ export default async function middlewareSSRLoader(this: any) { ...@@ -56,7 +56,6 @@ export default async function middlewareSSRLoader(this: any) {
buildManifest, buildManifest,
reactLoadableManifest, reactLoadableManifest,
serverComponentManifest: ${isServerComponent} ? rscManifest : null, serverComponentManifest: ${isServerComponent} ? rscManifest : null,
isServerComponent: ${isServerComponent},
config: ${stringifiedConfig}, config: ${stringifiedConfig},
buildId: ${JSON.stringify(buildId)}, buildId: ${JSON.stringify(buildId)},
}) })
......
...@@ -25,7 +25,6 @@ export function getRender({ ...@@ -25,7 +25,6 @@ export function getRender({
buildManifest, buildManifest,
reactLoadableManifest, reactLoadableManifest,
serverComponentManifest, serverComponentManifest,
isServerComponent,
config, config,
buildId, buildId,
}: { }: {
...@@ -39,7 +38,6 @@ export function getRender({ ...@@ -39,7 +38,6 @@ export function getRender({
buildManifest: BuildManifest buildManifest: BuildManifest
reactLoadableManifest: ReactLoadableManifest reactLoadableManifest: ReactLoadableManifest
serverComponentManifest: any | null serverComponentManifest: any | null
isServerComponent: boolean
config: NextConfig config: NextConfig
buildId: string buildId: string
}) { }) {
...@@ -109,10 +107,6 @@ export function getRender({ ...@@ -109,10 +107,6 @@ export function getRender({
const requestHandler = server.getRequestHandler() const requestHandler = server.getRequestHandler()
return async function render(request: NextRequest) { return async function render(request: NextRequest) {
const { nextUrl: url } = request
const { searchParams } = url
const query = Object.fromEntries(searchParams)
// Preflight request // Preflight request
if (request.method === 'HEAD') { if (request.method === 'HEAD') {
// Hint the client that the matched route is a SSR page. // Hint the client that the matched route is a SSR page.
...@@ -123,21 +117,6 @@ export function getRender({ ...@@ -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 extendedReq = new WebNextRequest(request)
const extendedRes = new WebNextResponse() const extendedRes = new WebNextResponse()
requestHandler(extendedReq, extendedRes) requestHandler(extendedReq, extendedRes)
......
...@@ -231,8 +231,6 @@ export type RenderOptsPartial = { ...@@ -231,8 +231,6 @@ export type RenderOptsPartial = {
resolvedUrl?: string resolvedUrl?: string
resolvedAsPath?: string resolvedAsPath?: string
serverComponentManifest?: any serverComponentManifest?: any
renderServerComponentData?: boolean
serverComponentProps?: any
distDir?: string distDir?: string
locale?: string locale?: string
locales?: string[] locales?: string[]
...@@ -451,7 +449,6 @@ export async function renderToHTML( ...@@ -451,7 +449,6 @@ export async function renderToHTML(
getStaticPaths, getStaticPaths,
getServerSideProps, getServerSideProps,
serverComponentManifest, serverComponentManifest,
serverComponentProps,
isDataReq, isDataReq,
params, params,
previewProps, previewProps,
...@@ -505,11 +502,17 @@ export async function renderToHTML( ...@@ -505,11 +502,17 @@ export async function renderToHTML(
return '' return ''
} }
let { renderServerComponentData } = renderOpts let renderServerComponentData = isServerComponent
if (isServerComponent && query.__flight__) { ? query.__flight__ !== undefined
renderServerComponentData = true : false
const serverComponentProps =
isServerComponent && query.__props__
? JSON.parse(query.__props__ as string)
: undefined
delete query.__flight__ delete query.__flight__
} delete query.__props__
const callMiddleware = async (method: string, args: any[], props = false) => { const callMiddleware = async (method: string, args: any[], props = false) => {
let results: any = props ? {} : [] let results: any = props ? {} : []
......
...@@ -203,8 +203,4 @@ export default class NextWebServer extends BaseServer { ...@@ -203,8 +203,4 @@ export default class NextWebServer extends BaseServer {
components: result, components: result,
} }
} }
public updateRenderOpts(renderOpts: Partial<BaseServer['renderOpts']>) {
Object.assign(this.renderOpts, renderOpts)
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment