[FIX] component: can destroy not yet mounted components

Sub-issue of #476
This commit is contained in:
Aaron Bohy
2019-11-20 11:08:11 +01:00
committed by Géry Debongnie
parent 7749fd3b96
commit 2922cee6ea
6 changed files with 68 additions and 33 deletions
+1 -1
View File
@@ -443,7 +443,7 @@ QWeb.addDirective({
);
ctx.addLine(`const fiber = w${componentID}.__owl__.currentFiber;`);
ctx.addLine(
`def${defID}.then(function () {if (fiber.isCompleted) {return;} const vnode = fiber.vnode; pvnode.sel = vnode.sel; ${createHook}});`
`def${defID}.then(function () { if (fiber.isCompleted) { w${componentID}.destroy(); return; } const vnode = fiber.vnode; pvnode.sel = vnode.sel; ${createHook}});`
);
if (registerCode) {
ctx.addLine(registerCode);