* Child nodes mutate the `projection` state of their parent node as they're being projected. * This function resets the `project` back to its initial state. * @param tNode
(tNode: TElementNode)
| 400 | * @param tNode |
| 401 | */ |
| 402 | function resetProjectionState(tNode: TElementNode): void { |
| 403 | // The `projection` is mutated by child nodes as they're being projected. We need to |
| 404 | // reset it to the initial state so projection works after the template is swapped out. |
| 405 | if (tNode.projection !== null) { |
| 406 | for (const current of tNode.projection) { |
| 407 | if (isTNodeShape(current)) { |
| 408 | // Reset `projectionNext` since it can affect the traversal order during projection. |
| 409 | current.projectionNext = null; |
| 410 | current.flags &= ~TNodeFlags.isProjected; |
| 411 | } |
| 412 | } |
| 413 | tNode.projection = null; |
| 414 | } |
| 415 | } |
no test coverage detected