Skip to content

Commit

Permalink
Add flight render starting point (#36760)
Browse files Browse the repository at this point in the history
## 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`
  • Loading branch information
timneutkens committed May 8, 2022
1 parent 26459ef commit 40e9891
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit 40e9891

Please sign in to comment.