Skip to content

Commit 6dbafdf

Browse files
committed
#7076 WIP
1 parent edeebfd commit 6dbafdf

3 files changed

Lines changed: 11 additions & 20 deletions

File tree

src/vdom/Helper.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ class Helper extends Base {
698698
throw new Error('Neo.vdom.Helper: StringFromVnode is not loaded yet for updates!');
699699
}
700700
}
701-
console.log(opts.vdom.id);
701+
702702
vnode = me.createVnode(opts.vdom);
703703
deltas = me.createDeltas({oldVnode: opts.vnode, vnode});
704704

test/siesta/tests/vdom/VdomAsymmetricUpdates.mjs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ const createMockComponent = (id, parentId, vdom) => {
2323
id,
2424
parentId,
2525
vdom,
26-
// Add properties and methods from VdomLifecycle that we need to test
27-
isVdomUpdating : false,
28-
currentUpdateDepth: null,
29-
resolveUpdateCache: [],
26+
// Add properties from VdomLifecycle that we need to test
27+
isVdomUpdating: false,
3028
// By adding the prototype methods to our mock instances, we can test
3129
// the lifecycle logic without needing full component instantiation.
3230
hasUpdateCollision: VdomLifecycle.prototype.hasUpdateCollision,
@@ -74,7 +72,6 @@ StartTest(t => {
7472
VDomUpdate.registerMerged(
7573
parent.id,
7674
child.id,
77-
[], // callbacks
7875
1, // childUpdateDepth
7976
1 // distance
8077
);
@@ -140,7 +137,6 @@ StartTest(t => {
140137
VDomUpdate.registerMerged(
141138
parent.id,
142139
grandchild.id,
143-
[], // callbacks
144140
1, // grandchild's own updateDepth
145141
2 // distance from parent
146142
);
@@ -203,7 +199,6 @@ StartTest(t => {
203199
VDomUpdate.registerMerged(
204200
parent.id,
205201
grandchild.id,
206-
[], // callbacks
207202
1, // grandchild's own updateDepth
208203
2 // distance from parent
209204
);
@@ -254,14 +249,13 @@ StartTest(t => {
254249
// 2. SIMULATE A PARENT UPDATE IN PROGRESS
255250
// This is the state during a real update, before post-processing.
256251
parent.isVdomUpdating = true;
257-
parent.currentUpdateDepth = 2; // Parent is updating itself and its direct children.
252+
VDomUpdate.registerInFlightUpdate(parent.id, 2);
258253

259254
// 3. SIMULATE A CHILD-INITIATED UPDATE (during the parent's update)
260255
let hasCollision = child.isParentUpdating(child.parentId, () => {});
261256

262257
// 4. ASSERTIONS
263258
t.ok(hasCollision, 'isParentUpdating should return true, detecting a collision');
264-
265259
const postUpdateQueue = VDomUpdate.postUpdateQueueMap.get(parent.id);
266260
t.ok(postUpdateQueue, 'Parent should have a post-update queue');
267261
t.is(postUpdateQueue.children.length, 1, 'Post-update queue should have one entry');
@@ -280,7 +274,7 @@ StartTest(t => {
280274

281275
// 2. SIMULATE A PARENT UPDATE IN PROGRESS
282276
parent.isVdomUpdating = true;
283-
parent.currentUpdateDepth = 2; // Parent update only includes direct children, NOT grandchildren.
277+
VDomUpdate.registerInFlightUpdate(parent.id, 2);
284278

285279
// 3. SIMULATE A GRANDCHILD-INITIATED UPDATE
286280
// The grandchild is at distance 2 from the parent. hasUpdateCollision(2, 2) should be false.
@@ -319,9 +313,9 @@ StartTest(t => {
319313

320314
// 2. SIMULATE MULTIPLE MERGED UPDATES
321315
// Grandchild1 (at distance 2) requests an update
322-
VDomUpdate.registerMerged(parent.id, grandchild1.id, [], 1, 2);
316+
VDomUpdate.registerMerged(parent.id, grandchild1.id, 1, 2);
323317
// Child3 (at distance 1) requests an update
324-
VDomUpdate.registerMerged(parent.id, child3.id, [], 1, 1);
318+
VDomUpdate.registerMerged(parent.id, child3.id, 1, 1);
325319

326320
// Make the changes to the source vdoms
327321
grandchild1.vdom.cn[0].text = 'Updated GC';
@@ -333,9 +327,8 @@ StartTest(t => {
333327
// The max should be taken.
334328
t.is(adjustedDepth, 3, 'Adjusted update depth should be 3, the max required by children');
335329

336-
const mergedChildIds = VDomUpdate.getMergedChildIds(parent.id);
337-
const newAsymmetricVdom = TreeBuilder.getVdomTree(parent.vdom, adjustedDepth, mergedChildIds);
338-
const oldAsymmetricVnode = TreeBuilder.getVnodeTree(parent.vnode, adjustedDepth, mergedChildIds);
330+
const newAsymmetricVdom = TreeBuilder.getVdomTree(parent.vdom, adjustedDepth);
331+
const oldAsymmetricVnode = TreeBuilder.getVnodeTree(parent.vnode, adjustedDepth);
339332

340333
// Verify the new VDOM structure is correctly expanded.
341334
// TreeBuilder expands based on depth, so non-updating siblings within the depth are also expanded.

test/siesta/tests/vdom/VdomRealWorldUpdates.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ StartTest(t => {
115115

116116
t.afterEach(t => {
117117
parent.destroy();
118-
parent = null;
119-
child = null;
118+
parent = null;
119+
child = null;
120120
grandchild = null;
121121
});
122122

@@ -131,8 +131,6 @@ StartTest(t => {
131131
});
132132

133133
t.it('Should handle a simple child-only update', async t => {
134-
await grandchild.timeout(5);
135-
136134
grandchild.setSilent({text: 'Updated Grandchild'});
137135
const {deltas} = await grandchild.promiseUpdate();
138136

0 commit comments

Comments
 (0)