mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] implement .alike suffix on props
It is common in Owl components to have anonymous function as props. However, since each rendering create a different (but equivalent) closure, Owl will consider the props different, so will update the child component, but this is (often) not necessary. This commit will help reduce the problem by introducing a new `.alike` prop suffix, that will let Owl know that each version of that specific prop should be considered the same, so, will be ignored by the props comparison code. closes #1360
This commit is contained in:
committed by
Sam Degueldre
parent
aadc9eafa3
commit
a51b286671
@@ -4,7 +4,7 @@ exports[`basics display a nice error if a component is not a component 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`SomeComponent\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`SomeComponent\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return comp1({}, key + \`__1\`, node, this, null);
|
||||
@@ -16,7 +16,7 @@ exports[`basics display a nice error if it cannot find component (in dev mode) 1
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`SomeMispelledComponent\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`SomeMispelledComponent\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
const props1 = {};
|
||||
@@ -30,7 +30,7 @@ exports[`basics display a nice error if it cannot find component 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`SomeMispelledComponent\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`SomeMispelledComponent\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return comp1({}, key + \`__1\`, node, this, null);
|
||||
@@ -42,7 +42,7 @@ exports[`basics display a nice error if the components key is missing with subco
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`MissingChild\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`MissingChild\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -57,7 +57,7 @@ exports[`basics no component catching error lead to full app destruction 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, false);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, [\\"flag\\"]);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -86,7 +86,7 @@ exports[`basics simple catchError 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Boom\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Boom\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
@@ -186,7 +186,7 @@ exports[`can catch errors an error in onWillDestroy 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
@@ -216,7 +216,7 @@ exports[`can catch errors an error in onWillDestroy, variation 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
@@ -258,8 +258,8 @@ exports[`can catch errors can catch an error in a component render function 1`]
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, false);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, [\\"flag\\"]);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -313,8 +313,8 @@ exports[`can catch errors can catch an error in the constructor call of a compon
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -354,9 +354,9 @@ exports[`can catch errors can catch an error in the constructor call of a compon
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ClassicCompoent\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp3 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ClassicCompoent\`, true, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
const comp3 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -437,8 +437,8 @@ exports[`can catch errors can catch an error in the initial call of a component
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -492,8 +492,8 @@ exports[`can catch errors can catch an error in the initial call of a component
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -549,7 +549,7 @@ exports[`can catch errors can catch an error in the mounted call (in child of ch
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`B\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`B\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return comp1({}, key + \`__1\`, node, this, null);
|
||||
@@ -561,7 +561,7 @@ exports[`can catch errors can catch an error in the mounted call (in child of ch
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`C\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`C\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -576,7 +576,7 @@ exports[`can catch errors can catch an error in the mounted call (in child of ch
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Boom\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Boom\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
@@ -609,7 +609,7 @@ exports[`can catch errors can catch an error in the mounted call (in root compon
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
@@ -643,8 +643,8 @@ exports[`can catch errors can catch an error in the mounted call 1`] = `
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -697,8 +697,8 @@ exports[`can catch errors can catch an error in the willPatch call 1`] = `
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, false);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, [\\"message\\"]);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><span><block-text-0/></span><block-child-0/></div>\`);
|
||||
|
||||
@@ -753,8 +753,8 @@ exports[`can catch errors can catch an error in the willStart call 1`] = `
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -807,9 +807,9 @@ exports[`can catch errors can catch an error origination from a child's willStar
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`ClassicCompoent\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp3 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`ClassicCompoent\`, true, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
const comp3 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -876,7 +876,7 @@ exports[`can catch errors catchError in catchError 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
@@ -896,7 +896,7 @@ exports[`can catch errors catchError in catchError 2`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Boom\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Boom\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -926,8 +926,8 @@ exports[`can catch errors catching error, rethrow, render parent -- a main comp
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { prepareList, capture, markRaw, withKey } = helpers;
|
||||
const comp1 = app.createComponent(null, false, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorHandler\`, true, true, false, false);
|
||||
const comp1 = app.createComponent(null, false, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorHandler\`, true, true, false, [\\"onError\\"]);
|
||||
|
||||
function slot1(ctx, node, key = \\"\\") {
|
||||
const Comp1 = ctx['cp'].Comp;
|
||||
@@ -966,7 +966,7 @@ exports[`can catch errors catching error, rethrow, render parent -- a main comp
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return comp1({}, key + \`__1\`, node, this, null);
|
||||
@@ -1005,8 +1005,8 @@ exports[`can catch errors catching in child makes parent render 1`] = `
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { prepareList, capture, markRaw, withKey } = helpers;
|
||||
const comp1 = app.createComponent(null, false, false, false, false);
|
||||
const comp2 = app.createComponent(\`Catch\`, true, true, false, false);
|
||||
const comp1 = app.createComponent(null, false, false, false, [\\"id\\"]);
|
||||
const comp2 = app.createComponent(\`Catch\`, true, true, false, [\\"onError\\"]);
|
||||
|
||||
function slot1(ctx, node, key = \\"\\") {
|
||||
const Comp1 = ctx['elem'][1];
|
||||
@@ -1073,9 +1073,9 @@ exports[`can catch errors error in mounted on a component with a sibling (proper
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
let { markRaw } = helpers;
|
||||
const comp1 = app.createComponent(\`OK\`, true, false, false, true);
|
||||
const comp2 = app.createComponent(\`ErrorComponent\`, true, false, false, true);
|
||||
const comp3 = app.createComponent(\`ErrorBoundary\`, true, true, false, true);
|
||||
const comp1 = app.createComponent(\`OK\`, true, false, false, []);
|
||||
const comp2 = app.createComponent(\`ErrorComponent\`, true, false, false, []);
|
||||
const comp3 = app.createComponent(\`ErrorBoundary\`, true, true, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
@@ -1139,7 +1139,7 @@ exports[`can catch errors onError in class inheritance is called if rethrown 1`]
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Concrete\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Concrete\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return comp1({}, key + \`__1\`, node, this, null);
|
||||
@@ -1170,7 +1170,7 @@ exports[`can catch errors onError in class inheritance is not called if no rethr
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Concrete\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Concrete\`, true, false, false, []);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return comp1({}, key + \`__1\`, node, this, null);
|
||||
@@ -1201,7 +1201,7 @@ exports[`errors and promises a rendering error in a sub component will reject th
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
@@ -1244,7 +1244,7 @@ exports[`errors and promises a rendering error will reject the render promise (w
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
|
||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user