mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] component: remove stale fiber in scheduler
Owl takes care of not rendering a component that will be unmounted immediately after, and it works. However, it also should clean up the newly added fiber.
This commit is contained in:
@@ -340,6 +340,7 @@ export class Component<T extends Env, Props extends {}> {
|
||||
// we were mounted when render was called, but we aren't anymore, so we
|
||||
// were actually about to be unmounted ; we can thus forget about this
|
||||
// fiber
|
||||
fiber.isCompleted = true;
|
||||
__owl__.currentFiber = null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5052,6 +5052,8 @@ describe("unmounting and remounting", () => {
|
||||
await nextTick(); // wait for changes to be detected before remounting
|
||||
await widget.mount(fixture);
|
||||
expect(fixture.innerHTML).toBe("<div>3</div>");
|
||||
// we want to make sure that there are no remaining tasks left at this point.
|
||||
expect(Component.scheduler.tasks.length).toBe(0);
|
||||
});
|
||||
|
||||
test("sub component is still active after being unmounted and remounted", async () => {
|
||||
|
||||
Reference in New Issue
Block a user