( request: Request, task: Task, keyPath: KeyNode, type: string, props: Object, )
| 2254 | } |
| 2255 | |
| 2256 | function renderHostElement( |
| 2257 | request: Request, |
| 2258 | task: Task, |
| 2259 | keyPath: KeyNode, |
| 2260 | type: string, |
| 2261 | props: Object, |
| 2262 | ): void { |
| 2263 | const segment = task.blockedSegment; |
| 2264 | if (segment === null) { |
| 2265 | // Replay |
| 2266 | const children = props.children; // TODO: Make this a Config for replaying. |
| 2267 | const prevContext = task.formatContext; |
| 2268 | const prevKeyPath = task.keyPath; |
| 2269 | task.formatContext = getChildFormatContext(prevContext, type, props); |
| 2270 | task.keyPath = keyPath; |
| 2271 | |
| 2272 | // We use the non-destructive form because if something suspends, we still |
| 2273 | // need to pop back up and finish this subtree of HTML. |
| 2274 | renderNode(request, task, children, -1); |
| 2275 | |
| 2276 | // We expect that errors will fatal the whole task and that we don't need |
| 2277 | // the correct context. Therefore this is not in a finally. |
| 2278 | task.formatContext = prevContext; |
| 2279 | task.keyPath = prevKeyPath; |
| 2280 | } else { |
| 2281 | // Render |
| 2282 | // RenderTask always has a preambleState |
| 2283 | const children = pushStartInstance( |
| 2284 | segment.chunks, |
| 2285 | type, |
| 2286 | props, |
| 2287 | request.resumableState, |
| 2288 | request.renderState, |
| 2289 | task.blockedPreamble, |
| 2290 | task.hoistableState, |
| 2291 | task.formatContext, |
| 2292 | segment.lastPushedText, |
| 2293 | ); |
| 2294 | segment.lastPushedText = false; |
| 2295 | const prevContext = task.formatContext; |
| 2296 | const prevKeyPath = task.keyPath; |
| 2297 | task.keyPath = keyPath; |
| 2298 | |
| 2299 | const newContext = (task.formatContext = getChildFormatContext( |
| 2300 | prevContext, |
| 2301 | type, |
| 2302 | props, |
| 2303 | )); |
| 2304 | if (isPreambleContext(newContext)) { |
| 2305 | // $FlowFixMe: Refined |
| 2306 | renderPreamble(request, (task: RenderTask), segment, children); |
| 2307 | } else { |
| 2308 | // We use the non-destructive form because if something suspends, we still |
| 2309 | // need to pop back up and finish this subtree of HTML. |
| 2310 | renderNode(request, task, children, -1); |
| 2311 | } |
| 2312 | |
| 2313 | // We expect that errors will fatal the whole task and that we don't need |
no test coverage detected