mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
2e3e8cd603
Following 2922cee6ea
Previous commit was not correct: used children with a cancelled
fiber (for instance, with a new currentFiber) could be destroyed.
This commit fixes the issue differently, by directly detecting
children that are not used anymore (and not mounted), and destroy
them directly (no need to wait for willStart promise to be resolved
anymore).
48 lines
2.0 KiB
Plaintext
48 lines
2.0 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`RouteComponent can render simple cases 1`] = `
|
|
"function anonymous(context,extra
|
|
) {
|
|
let utils = this.constructor.utils;
|
|
let QWeb = this.constructor;
|
|
let parent = context;
|
|
let owner = context;
|
|
let sibling = null;
|
|
let result;
|
|
var h = this.h;
|
|
if (context['routeComponent']) {
|
|
const nodeKey1 = context['env'].router.currentRouteName;
|
|
//COMPONENT
|
|
let k4 = \`__5__\` + nodeKey1;
|
|
let w3 = k4 in parent.__owl__.cmap ? parent.__owl__.children[parent.__owl__.cmap[k4]] : false;
|
|
let vn6 = {};
|
|
result = vn6;
|
|
let props3 = Object.assign({}, context['env'].router.currentParams);
|
|
if (w3 && w3.__owl__.currentFiber && !w3.__owl__.vnode) {
|
|
w3.destroy();
|
|
w3 = false;
|
|
}
|
|
if (w3) {
|
|
w3.__updateProps(props3, extra.fiber, undefined, undefined, sibling);
|
|
let pvnode = w3.__owl__.pvnode;
|
|
utils.defineProxy(vn6, pvnode);
|
|
} else {
|
|
let componentKey3 = \`routeComponent\`;
|
|
let W3 = context.constructor.components[componentKey3] || QWeb.components[componentKey3]|| context['routeComponent'];
|
|
if (!W3) {throw new Error('Cannot find the definition of component \\"' + componentKey3 + '\\"')}
|
|
w3 = new W3(parent, props3);
|
|
parent.__owl__.cmap[k4] = w3.__owl__.id;
|
|
let def2 = w3.__prepare(extra.fiber, undefined, undefined, sibling);
|
|
let pvnode = h('dummy', {key: k4, hook: {insert(vn) { let nvn=w3.__mount(fiber, pvnode.elm);pvnode.elm=nvn.elm;},remove() {},destroy(vn) {w3.destroy();}}});
|
|
const fiber = w3.__owl__.currentFiber;
|
|
def2.then(function () { if (fiber.isCompleted) { return; } const vnode = fiber.vnode; pvnode.sel = vnode.sel; });
|
|
utils.defineProxy(vn6, pvnode);
|
|
w3.__owl__.pvnode = pvnode;
|
|
}
|
|
w3.__owl__.parentLastFiberId = extra.fiber.id;
|
|
sibling = w3.__owl__.currentFiber || sibling;
|
|
}
|
|
return result;
|
|
}"
|
|
`;
|