Unverified Commit 170f4597 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

[metadata] clean up redudant options (#76712)

### What

streaming meatdata is fully enabled now, we don't need to pass down an extra flag through render options
parent 129368cf
...@@ -387,7 +387,6 @@ async function exportAppImpl( ...@@ -387,7 +387,6 @@ async function exportAppImpl(
strictNextHead: nextConfig.experimental.strictNextHead ?? true, strictNextHead: nextConfig.experimental.strictNextHead ?? true,
deploymentId: nextConfig.deploymentId, deploymentId: nextConfig.deploymentId,
htmlLimitedBots: nextConfig.htmlLimitedBots.source, htmlLimitedBots: nextConfig.htmlLimitedBots.source,
streamingMetadata: true,
experimental: { experimental: {
clientTraceMetadata: nextConfig.experimental.clientTraceMetadata, clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,
expireTime: nextConfig.expireTime, expireTime: nextConfig.expireTime,
......
...@@ -62,7 +62,6 @@ export interface ExportPageInput { ...@@ -62,7 +62,6 @@ export interface ExportPageInput {
nextConfigOutput?: NextConfigComplete['output'] nextConfigOutput?: NextConfigComplete['output']
enableExperimentalReact?: boolean enableExperimentalReact?: boolean
sriEnabled: boolean sriEnabled: boolean
streamingMetadata: boolean | undefined
} }
export type ExportRouteResult = export type ExportRouteResult =
......
...@@ -256,9 +256,7 @@ async function exportPageImpl( ...@@ -256,9 +256,7 @@ async function exportPageImpl(
// During the export phase in next build, if it's using PPR we can serve streaming metadata // During the export phase in next build, if it's using PPR we can serve streaming metadata
// when it's available. When we're building the PPR rendering result, we don't need to rely // when it's available. When we're building the PPR rendering result, we don't need to rely
// on the user agent. The result can be determined to serve streaming on infrastructure level. // on the user agent. The result can be determined to serve streaming on infrastructure level.
const serveStreamingMetadata = Boolean( const serveStreamingMetadata = !!isRoutePPREnabled
isRoutePPREnabled && input.streamingMetadata
)
const renderOpts: WorkerRenderOpts = { const renderOpts: WorkerRenderOpts = {
...components, ...components,
...@@ -425,7 +423,6 @@ export async function exportPages( ...@@ -425,7 +423,6 @@ export async function exportPages(
enableExperimentalReact: needsExperimentalReact(nextConfig), enableExperimentalReact: needsExperimentalReact(nextConfig),
sriEnabled: Boolean(nextConfig.experimental.sri?.algorithm), sriEnabled: Boolean(nextConfig.experimental.sri?.algorithm),
buildId: input.buildId, buildId: input.buildId,
streamingMetadata: true,
}), }),
// If exporting the page takes longer than the timeout, reject the promise. // If exporting the page takes longer than the timeout, reject the promise.
new Promise((_, reject) => { new Promise((_, reject) => {
......
...@@ -204,7 +204,6 @@ export interface RenderOptsPartial { ...@@ -204,7 +204,6 @@ export interface RenderOptsPartial {
params?: ParsedUrlQuery params?: ParsedUrlQuery
isPrefetch?: boolean isPrefetch?: boolean
htmlLimitedBots: string | undefined htmlLimitedBots: string | undefined
streamingMetadata: boolean
experimental: { experimental: {
/** /**
* When true, it indicates that the current page supports partial * When true, it indicates that the current page supports partial
......
...@@ -600,7 +600,6 @@ export default abstract class Server< ...@@ -600,7 +600,6 @@ export default abstract class Server<
isExperimentalCompile: this.nextConfig.experimental.isExperimentalCompile, isExperimentalCompile: this.nextConfig.experimental.isExperimentalCompile,
// `htmlLimitedBots` is passed to server as serialized config in string format // `htmlLimitedBots` is passed to server as serialized config in string format
htmlLimitedBots: this.nextConfig.htmlLimitedBots, htmlLimitedBots: this.nextConfig.htmlLimitedBots,
streamingMetadata: true,
experimental: { experimental: {
expireTime: this.nextConfig.expireTime, expireTime: this.nextConfig.expireTime,
clientTraceMetadata: this.nextConfig.experimental.clientTraceMetadata, clientTraceMetadata: this.nextConfig.experimental.clientTraceMetadata,
...@@ -1761,10 +1760,10 @@ export default abstract class Server< ...@@ -1761,10 +1760,10 @@ export default abstract class Server<
...this.renderOpts, ...this.renderOpts,
supportsDynamicResponse: !isBotRequest, supportsDynamicResponse: !isBotRequest,
botType: getBotType(ua), botType: getBotType(ua),
serveStreamingMetadata: shouldServeStreamingMetadata(ua, { serveStreamingMetadata: shouldServeStreamingMetadata(
streamingMetadata: !!this.renderOpts.streamingMetadata, ua,
htmlLimitedBots: this.nextConfig.htmlLimitedBots, this.nextConfig.htmlLimitedBots
}), ),
}, },
} }
......
...@@ -6,18 +6,8 @@ import type { BaseNextRequest } from '../base-http' ...@@ -6,18 +6,8 @@ import type { BaseNextRequest } from '../base-http'
export function shouldServeStreamingMetadata( export function shouldServeStreamingMetadata(
userAgent: string, userAgent: string,
{ htmlLimitedBots: string | undefined
streamingMetadata,
htmlLimitedBots,
}: {
streamingMetadata: boolean
htmlLimitedBots: string | undefined
}
): boolean { ): boolean {
if (!streamingMetadata) {
return false
}
const blockingMetadataUARegex = new RegExp( const blockingMetadataUARegex = new RegExp(
htmlLimitedBots || HTML_LIMITED_BOT_UA_RE_STRING, htmlLimitedBots || HTML_LIMITED_BOT_UA_RE_STRING,
'i' 'i'
......
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