Skip to content

Commit dbff692

Browse files
committed
#7076 manager.VDomUpdate: getAdjustedUpdateDepth()
1 parent d8a676c commit dbff692

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/util/vdom/TreeBuilder.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ class TreeBuilder extends Base {
4747
let currentItem = item;
4848

4949
if (currentItem.componentId) {
50-
// Expand if:
51-
// 1. We are not at the depth limit (depth > 1 or depth === -1).
52-
// 2. The child component is part of the set of components whose updates were merged into this one.
53-
if ((depth === -1 || depth > 1) && mergedChildIds?.has(currentItem.componentId)) {
50+
// A component is always expanded if depth is -1 (brute force).
51+
// Otherwise, it's expanded if:
52+
// 1. We are not at the depth limit (depth > 1).
53+
// 2. AND it's a full-depth render (mergedChildIds is null),
54+
// OR it's a selective update and the component is in the merged set.
55+
if (depth === -1 || (depth > 1 && (mergedChildIds === null || mergedChildIds.has(currentItem.componentId)))) {
5456
const component = ComponentManager.get(currentItem.componentId);
5557
if (component?.vdom) {
5658
currentItem = component.vdom;
@@ -91,10 +93,12 @@ class TreeBuilder extends Base {
9193
let currentItem = item;
9294

9395
if (currentItem.componentId) {
94-
// Expand if:
95-
// 1. We are not at the depth limit (depth > 1 or depth === -1).
96-
// 2. The child component is part of the set of components whose updates were merged into this one.
97-
if ((depth === -1 || depth > 1) && mergedChildIds?.has(currentItem.componentId)) {
96+
// A component is always expanded if depth is -1 (brute force).
97+
// Otherwise, it's expanded if:
98+
// 1. We are not at the depth limit (depth > 1).
99+
// 2. AND it's a full-depth render (mergedChildIds is null),
100+
// OR it's a selective update and the component is in the merged set.
101+
if (depth === -1 || (depth > 1 && (mergedChildIds === null || mergedChildIds.has(currentItem.componentId)))) {
98102
component = ComponentManager.get(currentItem.componentId);
99103

100104
// keep references in case there is no vnode (e.g. component not mounted yet)

0 commit comments

Comments
 (0)