[FIX] component: improve unmount/remount behaviour

This commit is contained in:
Géry Debongnie
2019-08-28 10:02:38 +02:00
parent 10cfe0b740
commit e6a3ede4a6
5 changed files with 196 additions and 24 deletions
+8 -1
View File
@@ -454,7 +454,14 @@ QWeb.addDirective({
ctx.addElse();
// need to update component
const patchQueueCode = async ? `patchQueue${componentID}` : "extra.patchQueue";
let patchQueueCode = async ? `patchQueue${componentID}` : "extra.patchQueue";
if (keepAlive) {
// if we have t-keepalive="1", the component could be unmounted, but then
// we __updateProps is called. This is ok, but we do not want to call
// the willPatch/patched hooks of the component in this case, so we
// disable the patch queue
patchQueueCode = `w${componentID}.__owl__.isMounted ? ${patchQueueCode} : []`;
}
if (QWeb.dev) {
ctx.addLine(`utils.validateProps(w${componentID}.constructor, props${componentID})`);
}