[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
This commit is contained in:
Achraf (abz)
2021-11-03 10:14:56 +01:00
committed by Géry Debongnie
parent 4e3b7c74da
commit 6950f8e628
+3 -2
View File
@@ -243,8 +243,9 @@ export class Fiber {
} }
component.__patch(target!, fiber.vnode!); component.__patch(target!, fiber.vnode!);
} else { } else {
if (fiber.shouldPatch) { const vnode = component.__owl__.vnode;
component.__patch(component.__owl__.vnode!, fiber.vnode!); if (fiber.shouldPatch && vnode) {
component.__patch(vnode, fiber.vnode!);
// When updating a Component's props (in directive), // When updating a Component's props (in directive),
// the component has a pvnode AND should be patched. // the component has a pvnode AND should be patched.
// However, its pvnode.elm may have changed if it is a High Order Component // However, its pvnode.elm may have changed if it is a High Order Component