From 6950f8e6284c4f46b75decf76c115ed56a4e9730 Mon Sep 17 00:00:00 2001 From: "Achraf (abz)" Date: Wed, 3 Nov 2021 10:14:56 +0100 Subject: [PATCH] [FIX] components/fiber: Call patch only if target is valid Currently in some cases, adding an attachment via lognote creates a traceback. Error : shouldPatch is true while `vnode` is not defined, so `patch()` failed This is a hotfix correcting this problem by calling `patch()` only if `shouldPatch` is true **and** the `vnode` is set. opw-2645203 --- src/component/fiber.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/component/fiber.ts b/src/component/fiber.ts index 9ad25c06..3ca2fe9b 100644 --- a/src/component/fiber.ts +++ b/src/component/fiber.ts @@ -243,8 +243,9 @@ export class Fiber { } component.__patch(target!, fiber.vnode!); } else { - if (fiber.shouldPatch) { - component.__patch(component.__owl__.vnode!, fiber.vnode!); + const vnode = component.__owl__.vnode; + if (fiber.shouldPatch && vnode) { + component.__patch(vnode, fiber.vnode!); // When updating a Component's props (in directive), // the component has a pvnode AND should be patched. // However, its pvnode.elm may have changed if it is a High Order Component