Add flight render starting point (#36760)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
This commit is contained in:
Tim Neutkens 2022-05-08 18:38:43 +02:00 committed by GitHub
parent 26459ef097
commit 40e9891175
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
})