From 7a49b9d94e5cf4fc64756b79d3d60186b715f222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 19 Sep 2019 15:14:04 +0200 Subject: [PATCH] [REF] component: move render props and promise to fiber part of #293 --- src/component/component.ts | 71 ++++--- src/component/directive.ts | 8 +- tests/__snapshots__/animations.test.ts.snap | 12 +- .../__snapshots__/component.test.ts.snap | 198 +++++++++--------- .../props_validation.test.ts.snap | 6 +- .../__snapshots__/RouteComponent.test.ts.snap | 6 +- 6 files changed, 153 insertions(+), 148 deletions(-) diff --git a/src/component/component.ts b/src/component/component.ts index a1974d6e..41160eb7 100644 --- a/src/component/component.ts +++ b/src/component/component.ts @@ -33,17 +33,24 @@ export interface Env { [key: string]: any; } -export interface Fiber { +/** + * Fibers are small abstractions designed to contain all the internal state + * associated to a "rendering work unit", relative to a specific component. + * + * A rendering will cause the creation of a fiber for each impacted components. + */ +export interface Fiber { force: boolean; - rootFiber: Fiber | null; + rootFiber: Fiber | null; isCancelled: boolean; scope: any; vars: any; - patchQueue: Fiber[]; + patchQueue: Fiber[]; component: Component; - // promises: any[]; vnode: VNode | null; willPatchResult: any; + props: Props; + promise: Promise | null; // handlers?: any; // mountedHandlers?: any; } @@ -70,13 +77,7 @@ interface Internal { // the component instance back whenever the template is rerendered. cmap: { [key: number]: number }; - renderId: number; - - // the renderProps and renderPromise keys are only useful for the "prepare" - // step of the lifecycle of a component. Once a component has been rendered - // and patched, it is no longer useful. - renderProps: Props | null; - renderPromise: Promise | null; + currentFiber: Fiber | null; boundHandlers: { [key: number]: any }; observer: Observer | null; @@ -184,9 +185,7 @@ export class Component { parent: p, children: {}, cmap: {}, - renderId: 1, - renderPromise: null, - renderProps: props || null, + currentFiber: null, boundHandlers: {}, mountedHandlers: {}, observer: null, @@ -296,7 +295,8 @@ export class Component { } const fiber = this.__createRootFiber(false); if (!__owl__.vnode) { - const vnode = await this.__prepareAndRender(fiber); + fiber.promise = this.__prepareAndRender(fiber); + const vnode = await fiber.promise; if (__owl__.isDestroyed) { // component was destroyed before we get here... return; @@ -304,7 +304,8 @@ export class Component { this.__patch(vnode); } else if (renderBeforeRemount) { fiber.patchQueue.push(fiber); - await this.__render(fiber); + fiber.promise = this.__render(fiber); + await fiber.promise; this.__applyPatchQueue(fiber); } target.appendChild(this.el!); @@ -341,19 +342,18 @@ export class Component { } const fiber = this.__createRootFiber(force); fiber.patchQueue.push(fiber); + fiber.promise = this.__render(fiber); + await fiber.promise; - const renderId = ++__owl__.renderId; - await this.__render(fiber); - - if (__owl__.isMounted && renderId === __owl__.renderId) { + if (__owl__.isMounted && fiber === __owl__.currentFiber) { // we only update the vnode and the actual DOM if no other rendering // occurred between now and when the render method was initially called. this.__applyPatchQueue(fiber); } } - __createRootFiber(force): Fiber { - const fiber: Fiber = { + __createRootFiber(force): Fiber { + const fiber: Fiber = { force, scope: undefined, vars: undefined, @@ -362,19 +362,25 @@ export class Component { component: this, vnode: null, patchQueue: [], - willPatchResult: null + willPatchResult: null, + props: this.props, + promise: null }; fiber.rootFiber = fiber; + this.__owl__.currentFiber = fiber; return fiber; } - __createSubFiber(parent: Fiber, scope, vars): Fiber { + __createSubFiber(parent: Fiber, scope, vars): Fiber { const fiber = Object.create(parent); fiber.scope = scope; fiber.vars = vars; fiber.component = this; fiber.vnode = null; fiber.willPatchResult = null; + this.__owl__.currentFiber = fiber; + fiber.props = this.props; + fiber.promise = null; return fiber; } @@ -519,7 +525,7 @@ export class Component { */ async __updateProps( nextProps: Props, - parentFiber: Fiber, + parentFiber: Fiber, scope?: any, vars?: any ): Promise { @@ -553,16 +559,13 @@ export class Component { * subcomponent is created. It gets its scope and vars, if any, from the * parent template. */ - __prepare(parentFiber: Fiber, scope: any, vars: any): Promise { - const __owl__ = this.__owl__; + __prepare(parentFiber: Fiber, scope: any, vars: any): Promise { const fiber = this.__createSubFiber(parentFiber, scope, vars); - - __owl__.renderProps = this.props; - __owl__.renderPromise = this.__prepareAndRender(fiber); - return __owl__.renderPromise; + fiber.promise = this.__prepareAndRender(fiber); + return fiber.promise; } - async __prepareAndRender(fiber: Fiber): Promise { + async __prepareAndRender(fiber: Fiber): Promise { try { await this.willStart(); } catch (e) { @@ -600,7 +603,7 @@ export class Component { return this.__render(fiber); } - __render(fiber: Fiber): Promise { + __render(fiber: Fiber): Promise { const __owl__ = this.__owl__; const promises: Promise[] = []; if (__owl__.observer) { @@ -701,7 +704,7 @@ export class Component { * 2) Call '__patch' on the component of each patch * 3) Call 'patched' on the component of each patch, in reverse order */ - __applyPatchQueue(fiber: Fiber) { + __applyPatchQueue(fiber: Fiber) { const patchQueue = fiber.patchQueue; let component: Component = this; try { diff --git a/src/component/directive.ts b/src/component/directive.ts index f1ae503c..948008f7 100644 --- a/src/component/directive.ts +++ b/src/component/directive.ts @@ -384,10 +384,12 @@ QWeb.addDirective({ ctx.addLine(`let props${componentID} = {${propStr}};`); } ctx.addIf( - `w${componentID} && w${componentID}.__owl__.renderPromise && !w${componentID}.__owl__.vnode` + `w${componentID} && w${componentID}.__owl__.currentFiber && !w${componentID}.__owl__.vnode` ); - ctx.addIf(`utils.shallowEqual(props${componentID}, w${componentID}.__owl__.renderProps)`); - ctx.addLine(`def${defID} = w${componentID}.__owl__.renderPromise;`); + ctx.addIf( + `utils.shallowEqual(props${componentID}, w${componentID}.__owl__.currentFiber.props)` + ); + ctx.addLine(`def${defID} = w${componentID}.__owl__.currentFiber.promise;`); ctx.addElse(); ctx.addLine(`w${componentID}.destroy();`); ctx.addLine(`w${componentID} = false;`); diff --git a/tests/__snapshots__/animations.test.ts.snap b/tests/__snapshots__/animations.test.ts.snap index 2503d3aa..c9f40872 100644 --- a/tests/__snapshots__/animations.test.ts.snap +++ b/tests/__snapshots__/animations.test.ts.snap @@ -17,9 +17,9 @@ exports[`animations t-transition combined with component 1`] = ` let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -63,9 +63,9 @@ exports[`animations t-transition combined with t-component and t-if 1`] = ` let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; diff --git a/tests/component/__snapshots__/component.test.ts.snap b/tests/component/__snapshots__/component.test.ts.snap index a26579ba..3e6dc975 100644 --- a/tests/component/__snapshots__/component.test.ts.snap +++ b/tests/component/__snapshots__/component.test.ts.snap @@ -30,9 +30,9 @@ exports[`async rendering delayed component with t-asyncroot directive 1`] = ` let _6_index = c5.length; c5.push(null); let props8 = {val:context['state'].val}; - if (w8 && w8.__owl__.renderPromise && !w8.__owl__.vnode) { - if (utils.shallowEqual(props8, w8.__owl__.renderProps)) { - def7 = w8.__owl__.renderPromise; + if (w8 && w8.__owl__.currentFiber && !w8.__owl__.vnode) { + if (utils.shallowEqual(props8, w8.__owl__.currentFiber.props)) { + def7 = w8.__owl__.currentFiber.promise; } else { w8.destroy(); w8 = false; @@ -58,9 +58,9 @@ exports[`async rendering delayed component with t-asyncroot directive 1`] = ` const fiber11 = Object.assign(Object.create(extra.fiber), {patchQueue: []}); c5.push(w11 && w11.__owl__.pvnode || null); let props11 = {val:context['state'].val}; - if (w11 && w11.__owl__.renderPromise && !w11.__owl__.vnode) { - if (utils.shallowEqual(props11, w11.__owl__.renderProps)) { - def10 = w11.__owl__.renderPromise; + if (w11 && w11.__owl__.currentFiber && !w11.__owl__.vnode) { + if (utils.shallowEqual(props11, w11.__owl__.currentFiber.props)) { + def10 = w11.__owl__.currentFiber.promise; } else { w11.destroy(); w11 = false; @@ -114,9 +114,9 @@ exports[`async rendering fast component with t-asyncroot directive 1`] = ` const fiber8 = Object.assign(Object.create(extra.fiber), {patchQueue: []}); c5.push(w8 && w8.__owl__.pvnode || null); let props8 = {val:context['state'].val}; - if (w8 && w8.__owl__.renderPromise && !w8.__owl__.vnode) { - if (utils.shallowEqual(props8, w8.__owl__.renderProps)) { - def7 = w8.__owl__.renderPromise; + if (w8 && w8.__owl__.currentFiber && !w8.__owl__.vnode) { + if (utils.shallowEqual(props8, w8.__owl__.currentFiber.props)) { + def7 = w8.__owl__.currentFiber.promise; } else { w8.destroy(); w8 = false; @@ -141,9 +141,9 @@ exports[`async rendering fast component with t-asyncroot directive 1`] = ` let _9_index = c5.length; c5.push(null); let props11 = {val:context['state'].val}; - if (w11 && w11.__owl__.renderPromise && !w11.__owl__.vnode) { - if (utils.shallowEqual(props11, w11.__owl__.renderProps)) { - def10 = w11.__owl__.renderPromise; + if (w11 && w11.__owl__.currentFiber && !w11.__owl__.vnode) { + if (utils.shallowEqual(props11, w11.__owl__.currentFiber.props)) { + def10 = w11.__owl__.currentFiber.promise; } else { w11.destroy(); w11 = false; @@ -196,9 +196,9 @@ exports[`async rendering t-component with t-asyncroot directive: mixed re-render let _6_index = c5.length; c5.push(null); let props8 = {val:context['state'].val}; - if (w8 && w8.__owl__.renderPromise && !w8.__owl__.vnode) { - if (utils.shallowEqual(props8, w8.__owl__.renderProps)) { - def7 = w8.__owl__.renderPromise; + if (w8 && w8.__owl__.currentFiber && !w8.__owl__.vnode) { + if (utils.shallowEqual(props8, w8.__owl__.currentFiber.props)) { + def7 = w8.__owl__.currentFiber.promise; } else { w8.destroy(); w8 = false; @@ -224,9 +224,9 @@ exports[`async rendering t-component with t-asyncroot directive: mixed re-render const fiber11 = Object.assign(Object.create(extra.fiber), {patchQueue: []}); c5.push(w11 && w11.__owl__.pvnode || null); let props11 = {val:context['state'].val}; - if (w11 && w11.__owl__.renderPromise && !w11.__owl__.vnode) { - if (utils.shallowEqual(props11, w11.__owl__.renderProps)) { - def10 = w11.__owl__.renderPromise; + if (w11 && w11.__owl__.currentFiber && !w11.__owl__.vnode) { + if (utils.shallowEqual(props11, w11.__owl__.currentFiber.props)) { + def10 = w11.__owl__.currentFiber.promise; } else { w11.destroy(); w11 = false; @@ -267,9 +267,9 @@ exports[`class and style attributes with t-component dynamic t-att-style is prop let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -312,9 +312,9 @@ exports[`class and style attributes with t-component t-att-class is properly add let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -372,9 +372,9 @@ exports[`class and style attributes with t-component t-att-class is properly add let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -430,9 +430,9 @@ exports[`class and style attributes with t-component t-att-class is properly add let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -475,9 +475,9 @@ exports[`composition sub components dom state with t-keepalive is preserved 1`] const fiber4 = Object.assign(Object.create(extra.fiber), {patchQueue: []}); c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -535,9 +535,9 @@ exports[`composition sub components with some state rendered in a loop 1`] = ` let _5_index = c1.length; c1.push(null); let props7 = {}; - if (w7 && w7.__owl__.renderPromise && !w7.__owl__.vnode) { - if (utils.shallowEqual(props7, w7.__owl__.renderProps)) { - def6 = w7.__owl__.renderPromise; + if (w7 && w7.__owl__.currentFiber && !w7.__owl__.vnode) { + if (utils.shallowEqual(props7, w7.__owl__.currentFiber.props)) { + def6 = w7.__owl__.currentFiber.promise; } else { w7.destroy(); w7 = false; @@ -578,9 +578,9 @@ exports[`composition t-component with dynamic value 1`] = ` let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -620,9 +620,9 @@ exports[`composition t-component with dynamic value 2 1`] = ` let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -662,9 +662,9 @@ exports[`dynamic t-props basic use 1`] = ` let _2_index = c1.length; c1.push(null); let props4 = Object.assign({}, context['some'].obj); - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -706,9 +706,9 @@ exports[`lifecycle hooks willPatch/patched hook with t-keepalive 1`] = ` const fiber4 = Object.assign(Object.create(extra.fiber), {patchQueue: []}); c1.push(null); let props4 = {v:context['state'].n}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -749,9 +749,9 @@ exports[`other directives with t-component t-on with handler bound to argument 1 let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -791,9 +791,9 @@ exports[`other directives with t-component t-on with handler bound to empty obje let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -833,9 +833,9 @@ exports[`other directives with t-component t-on with handler bound to empty obje let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -875,9 +875,9 @@ exports[`other directives with t-component t-on with handler bound to object 1`] let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -917,9 +917,9 @@ exports[`other directives with t-component t-on with prevent and self modifiers let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -959,9 +959,9 @@ exports[`other directives with t-component t-on with self and prevent modifiers let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -1001,9 +1001,9 @@ exports[`other directives with t-component t-on with self modifier 1`] = ` let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -1043,9 +1043,9 @@ exports[`other directives with t-component t-on with stop and/or prevent modifie let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -1087,9 +1087,9 @@ exports[`random stuff/miscellaneous snapshotting compiled code 1`] = ` let _2_index = c1.length; c1.push(null); let props4 = {flag:context['state'].flag}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -1147,9 +1147,9 @@ exports[`random stuff/miscellaneous t-on with handler bound to dynamic argument let _5_index = c1.length; c1.push(null); let props7 = {}; - if (w7 && w7.__owl__.renderPromise && !w7.__owl__.vnode) { - if (utils.shallowEqual(props7, w7.__owl__.renderProps)) { - def6 = w7.__owl__.renderPromise; + if (w7 && w7.__owl__.currentFiber && !w7.__owl__.vnode) { + if (utils.shallowEqual(props7, w7.__owl__.currentFiber.props)) { + def6 = w7.__owl__.currentFiber.promise; } else { w7.destroy(); w7 = false; @@ -1371,9 +1371,9 @@ exports[`t-slot directive can define and call slots 1`] = ` let _2_index = c1.length; c1.push(null); let props4 = {}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; @@ -1613,9 +1613,9 @@ exports[`t-slot directive slots are rendered with proper context, part 2 2`] = ` let _7_index = c6.length; c6.push(null); let props9 = {to:'/user/'+context['user'].id}; - if (w9 && w9.__owl__.renderPromise && !w9.__owl__.vnode) { - if (utils.shallowEqual(props9, w9.__owl__.renderProps)) { - def8 = w9.__owl__.renderPromise; + if (w9 && w9.__owl__.currentFiber && !w9.__owl__.vnode) { + if (utils.shallowEqual(props9, w9.__owl__.currentFiber.props)) { + def8 = w9.__owl__.currentFiber.promise; } else { w9.destroy(); w9 = false; @@ -1718,9 +1718,9 @@ exports[`t-slot directive slots are rendered with proper context, part 3 2`] = ` let _8_index = c6.length; c6.push(null); let props10 = {to:'/user/'+context['user'].id}; - if (w10 && w10.__owl__.renderPromise && !w10.__owl__.vnode) { - if (utils.shallowEqual(props10, w10.__owl__.renderProps)) { - def9 = w10.__owl__.renderPromise; + if (w10 && w10.__owl__.currentFiber && !w10.__owl__.vnode) { + if (utils.shallowEqual(props10, w10.__owl__.currentFiber.props)) { + def9 = w10.__owl__.currentFiber.promise; } else { w10.destroy(); w10 = false; @@ -1776,9 +1776,9 @@ exports[`t-slot directive slots are rendered with proper context, part 4 1`] = ` let _3_index = c1.length; c1.push(null); let props5 = {to:'/user/'+context['state'].user.id}; - if (w5 && w5.__owl__.renderPromise && !w5.__owl__.vnode) { - if (utils.shallowEqual(props5, w5.__owl__.renderProps)) { - def4 = w5.__owl__.renderPromise; + if (w5 && w5.__owl__.currentFiber && !w5.__owl__.vnode) { + if (utils.shallowEqual(props5, w5.__owl__.currentFiber.props)) { + def4 = w5.__owl__.currentFiber.promise; } else { w5.destroy(); w5 = false; @@ -1830,9 +1830,9 @@ exports[`top level sub widgets basic use 1`] = ` let vn4 = {}; result = vn4; let props3 = {p:1}; - if (w3 && w3.__owl__.renderPromise && !w3.__owl__.vnode) { - if (utils.shallowEqual(props3, w3.__owl__.renderProps)) { - def2 = w3.__owl__.renderPromise; + if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) { + if (utils.shallowEqual(props3, w3.__owl__.currentFiber.props)) { + def2 = w3.__owl__.currentFiber.promise; } else { w3.destroy(); w3 = false; @@ -1871,9 +1871,9 @@ exports[`top level sub widgets can select a sub widget 1`] = ` let vn4 = {}; result = vn4; let props3 = {}; - if (w3 && w3.__owl__.renderPromise && !w3.__owl__.vnode) { - if (utils.shallowEqual(props3, w3.__owl__.renderProps)) { - def2 = w3.__owl__.renderPromise; + if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) { + if (utils.shallowEqual(props3, w3.__owl__.currentFiber.props)) { + def2 = w3.__owl__.currentFiber.promise; } else { w3.destroy(); w3 = false; @@ -1900,9 +1900,9 @@ exports[`top level sub widgets can select a sub widget 1`] = ` let vn8 = {}; result = vn8; let props7 = {}; - if (w7 && w7.__owl__.renderPromise && !w7.__owl__.vnode) { - if (utils.shallowEqual(props7, w7.__owl__.renderProps)) { - def6 = w7.__owl__.renderPromise; + if (w7 && w7.__owl__.currentFiber && !w7.__owl__.vnode) { + if (utils.shallowEqual(props7, w7.__owl__.currentFiber.props)) { + def6 = w7.__owl__.currentFiber.promise; } else { w7.destroy(); w7 = false; diff --git a/tests/component/__snapshots__/props_validation.test.ts.snap b/tests/component/__snapshots__/props_validation.test.ts.snap index c2227ac2..3ccffd98 100644 --- a/tests/component/__snapshots__/props_validation.test.ts.snap +++ b/tests/component/__snapshots__/props_validation.test.ts.snap @@ -21,9 +21,9 @@ exports[`props validation props are validated in dev mode (code snapshot) 1`] = let _2_index = c1.length; c1.push(null); let props4 = {message:1}; - if (w4 && w4.__owl__.renderPromise && !w4.__owl__.vnode) { - if (utils.shallowEqual(props4, w4.__owl__.renderProps)) { - def3 = w4.__owl__.renderPromise; + if (w4 && w4.__owl__.currentFiber && !w4.__owl__.vnode) { + if (utils.shallowEqual(props4, w4.__owl__.currentFiber.props)) { + def3 = w4.__owl__.currentFiber.promise; } else { w4.destroy(); w4 = false; diff --git a/tests/router/__snapshots__/RouteComponent.test.ts.snap b/tests/router/__snapshots__/RouteComponent.test.ts.snap index 601c0413..9d8097f3 100644 --- a/tests/router/__snapshots__/RouteComponent.test.ts.snap +++ b/tests/router/__snapshots__/RouteComponent.test.ts.snap @@ -32,9 +32,9 @@ exports[`RouteComponent can render simple cases 1`] = ` let vn8 = {}; result = vn8; let props6 = Object.assign({}, context['env'].router.currentParams); - if (w6 && w6.__owl__.renderPromise && !w6.__owl__.vnode) { - if (utils.shallowEqual(props6, w6.__owl__.renderProps)) { - def5 = w6.__owl__.renderPromise; + if (w6 && w6.__owl__.currentFiber && !w6.__owl__.vnode) { + if (utils.shallowEqual(props6, w6.__owl__.currentFiber.props)) { + def5 = w6.__owl__.currentFiber.promise; } else { w6.destroy(); w6 = false;