PROTOTYPE: batch renders in animation frame instead of microtick

This commit is contained in:
Samuel Degueldre
2022-02-23 11:55:53 +01:00
parent 0dbd2bd463
commit aef6923c23
2 changed files with 56 additions and 40 deletions
+2 -5
View File
@@ -97,17 +97,14 @@ test("destroying/recreating a subwidget with different props (if start is not ov
expect(["W:setup", "W:willStart", "W:willRender", "W:rendered", "W:mounted"]).toBeLogged();
expect(n).toBe(0);
w.state.val = 2;
await nextMicroTick();
await nextMicroTick();
await new Promise(requestAnimationFrame); // calls to _render are batched per animation frame
expect(n).toBe(1);
expect(["W:willRender", "Child:setup", "Child:willStart", "W:rendered"]).toBeLogged();
w.state.val = 3;
await nextMicroTick();
await nextMicroTick();
await new Promise(requestAnimationFrame);
expect(n).toBe(2);
expect([