Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flight render starting point #36760

Merged
merged 8 commits into from May 8, 2022
14 changes: 12 additions & 2 deletions packages/next/server/view-render.tsx
Expand Up @@ -219,9 +219,19 @@ export async function renderToHTML(
const hasConcurrentFeatures = !!runtime
const pageIsDynamic = isDynamicRoute(pathname)
const components = Object.keys(ComponentMod.components)
.filter((path) => {
const { __flight__, __flight_router_path__: routerPath } = query
// Rendering part of the page is only allowed for flight data
if (__flight__ !== undefined && routerPath) {
// TODO: check the actual path
const pathLength = path.length
return pathLength >= routerPath.length
}
return true
})
.sort()
.map((key) => {
const mod = ComponentMod.components[key]()
.map((path) => {
const mod = ComponentMod.components[path]()
mod.Component = mod.default || mod
return mod
})
Expand Down