[FIX] app: sync destroy everythig when app is destroyed

Before this commit, the App destroy method would not destroy everything
synchronously. The code scheduled a flush, which is asynchronous, to
finally clean up the task lists, and destroy the cancelled nodes. But
this is not really good for tests: we need a stronger guarantee that
nothing will happen after the destroy.

With this commit, we simply call the processTask method immediately
after destroying the root component, so all cancelled nodes will be
destroyed immediately.
This commit is contained in:
Géry Debongnie
2023-07-19 16:54:56 +02:00
committed by Sam Degueldre
parent ca688d8640
commit b1a3b322ee
3 changed files with 79 additions and 3 deletions
+1 -1
View File
@@ -136,8 +136,8 @@ export class App<
destroy() {
if (this.root) {
this.scheduler.flush();
this.root.destroy();
this.scheduler.processTasks();
}
window.__OWL_DEVTOOLS__.apps.delete(this);
}