From fb64355f594ba192e3bd473feddbca73f8ef8aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 13 Jan 2022 15:18:41 +0100 Subject: [PATCH] wip --- src/app/template_helpers.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/template_helpers.ts b/src/app/template_helpers.ts index 82773a39..10de502d 100644 --- a/src/app/template_helpers.ts +++ b/src/app/template_helpers.ts @@ -20,7 +20,12 @@ function callPortal( target: string, content: (ctx: any, node: any, key: string) => BDom ): BDom { - return new VPortal(target, content(ctx, parent, key)) as any; + const portal = new VPortal(target, content(ctx, parent, key)) as any; + // make sure we cleanup only once + if (!ctx.__owl) + ctx.__owl__.willDestroy.push(() => portal.cleanup()); + ctx.__owl__.hasPortal = true; + return portal; } function callSlot(