Commit graph

3 commits

Author SHA1 Message Date
Andrew Kushnir
ced237693a refactor(core): adding hydration for content projection (#49454)
This commit adds serialization and hydration logic for content projection.

While hydration for regular elements relies on their location in the TNode tree, the content projection may move elements around, so in order to hydrate them correcty, the runtime needs some extra information. This commit adds a serialization logic that adds element locations (instructions on how to navigate to a particular element from another known location of other element) into the hydration state for the following cases:

- when a TNode is a first element in projection segment (other nodes are linked from that node)
- when a TNode's next sibling is different before and after projection (we serialize extra info about the template-based sibling)
- when a TNode's previous sibling was a content projection (i.e. `<ng-content>` slot), because we can not rely on the previous element in this case (projection happens at a later point)

PR Close #49454
2023-03-21 17:42:53 +01:00
Pawel Kozlowski
81b9e858a8 Revert "refactor(core): adding hydration for content projection (#49454)" (#49511)
This reverts commit 7885f35fd6.

PR Close #49511
2023-03-21 13:51:14 +01:00
Andrew Kushnir
7885f35fd6 refactor(core): adding hydration for content projection (#49454)
This commit adds serialization and hydration logic for content projection.

While hydration for regular elements relies on their location in the TNode tree, the content projection may move elements around, so in order to hydrate them correcty, the runtime needs some extra information. This commit adds a serialization logic that adds element locations (instructions on how to navigate to a particular element from another known location of other element) into the hydration state for the following cases:

- when a TNode is a first element in projection segment (other nodes are linked from that node)
- when a TNode's next sibling is different before and after projection (we serialize extra info about the template-based sibling)
- when a TNode's previous sibling was a content projection (i.e. `<ng-content>` slot), because we can not rely on the previous element in this case (projection happens at a later point)

PR Close #49454
2023-03-21 09:44:03 +01:00