[IMP] app: add fast path for when component has no prop

This commit is contained in:
Géry Debongnie
2022-06-09 14:55:57 +02:00
committed by Sam Degueldre
parent d046913a01
commit 55ac43c1db
26 changed files with 548 additions and 541 deletions
+42 -42
View File
@@ -6,7 +6,7 @@ exports[`Portal Add and remove portals 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
function slot1(ctx, node, key = \\"\\") {
const b3 = text(\` Portal\`);
@@ -34,7 +34,7 @@ exports[`Portal Add and remove portals on div 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block2 = createBlock(\`<div> Portal<block-text-0/></div>\`);
@@ -63,7 +63,7 @@ exports[`Portal Add and remove portals with t-foreach 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block2 = createBlock(\`<div><block-text-0/><block-child-0/></div>\`);
@@ -95,7 +95,7 @@ exports[`Portal Add and remove portals with t-foreach and destroy 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block2 = createBlock(\`<div><block-text-0/><block-child-0/></div>\`);
@@ -127,7 +127,7 @@ exports[`Portal Add and remove portals with t-foreach inside div 1`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<div><block-text-0/><block-child-0/></div>\`);
@@ -160,8 +160,8 @@ exports[`Portal Portal composed with t-slot 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { markRaw } = helpers;
const comp1 = app.createComponent(\`Child2\`, true, false, false);
const comp2 = app.createComponent(\`Child\`, true, true, false);
const comp1 = app.createComponent(\`Child2\`, true, false, false, false);
const comp2 = app.createComponent(\`Child\`, true, true, false, true);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
@@ -182,7 +182,7 @@ exports[`Portal Portal composed with t-slot 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { callSlot } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
function slot1(ctx, node, key = \\"\\") {
return callSlot(ctx, node, key, 'default', false, {});
@@ -213,7 +213,7 @@ exports[`Portal basic use of portal 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -234,7 +234,7 @@ exports[`Portal basic use of portal in dev mode 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -255,7 +255,7 @@ exports[`Portal basic use of portal on div 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<div><p>2</p></div>\`);
@@ -276,7 +276,7 @@ exports[`Portal basic use of portal, variation 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -297,8 +297,8 @@ exports[`Portal conditional use of Portal (with sub Component) 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
let block2 = createBlock(\`<span>1</span>\`);
@@ -336,7 +336,7 @@ exports[`Portal conditional use of Portal 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block2 = createBlock(\`<span>1</span>\`);
let block3 = createBlock(\`<p>2</p>\`);
@@ -360,7 +360,7 @@ exports[`Portal conditional use of Portal with child and div 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
return function template(ctx, node, key = \\"\\") {
let b2;
@@ -378,7 +378,7 @@ exports[`Portal conditional use of Portal with child and div 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><span>hasPortal</span><block-child-0/></div>\`);
let block3 = createBlock(\`<p>thePortal</p>\`);
@@ -406,7 +406,7 @@ exports[`Portal conditional use of Portal with child and div, variation 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
let block2 = createBlock(\`<div><block-child-0/></div>\`);
@@ -427,7 +427,7 @@ exports[`Portal conditional use of Portal with child and div, variation 2`] = `
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
let { prepareList, capture, withKey } = helpers;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block2 = createBlock(\`<span>hasPortal</span>\`);
let block4 = createBlock(\`<p>thePortal</p>\`);
@@ -457,7 +457,7 @@ exports[`Portal conditional use of Portal with div 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block2 = createBlock(\`<div><span>hasPortal</span><block-child-0/></div>\`);
let block3 = createBlock(\`<p>thePortal</p>\`);
@@ -482,8 +482,8 @@ exports[`Portal lifecycle hooks of portal sub component are properly called 1`]
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/><block-child-0/></div>\`);
@@ -520,7 +520,7 @@ exports[`Portal portal could have dynamically no content 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<span><block-text-0/></span>\`);
@@ -546,8 +546,8 @@ exports[`Portal portal destroys on crash 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
@@ -581,8 +581,8 @@ exports[`Portal portal with child and props 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
@@ -616,7 +616,7 @@ exports[`Portal portal with dynamic body 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<span><block-text-0/></span>\`);
@@ -645,7 +645,7 @@ exports[`Portal portal with many children 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block3 = createBlock(\`<div>1</div>\`);
@@ -669,7 +669,7 @@ exports[`Portal portal with no content 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
@@ -693,7 +693,7 @@ exports[`Portal portal with only text as content 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
@@ -713,7 +713,7 @@ exports[`Portal portal with target not in dom 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block2 = createBlock(\`<div>2</div>\`);
@@ -734,8 +734,8 @@ exports[`Portal portal's parent's env is not polluted 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(\`Child\`, true, false, false, true);
const comp2 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
@@ -767,7 +767,7 @@ exports[`Portal simple catchError with portal 1`] = `
"function anonymous(app, bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const comp1 = app.createComponent(\`Boom\`, true, false, false);
const comp1 = app.createComponent(\`Boom\`, true, false, false, true);
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
@@ -788,7 +788,7 @@ exports[`Portal simple catchError with portal 2`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p><block-text-0/></p>\`);
@@ -810,7 +810,7 @@ exports[`Portal with target in template (after portal) 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><span>1</span><block-child-0/><div id=\\"local-target\\"/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -831,7 +831,7 @@ exports[`Portal with target in template (before portal) 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><div id=\\"local-target\\"/><span>1</span><block-child-0/></div>\`);
let block2 = createBlock(\`<p>2</p>\`);
@@ -852,7 +852,7 @@ exports[`Portal: Props validation target must be a valid selector 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block2 = createBlock(\`<div>2</div>\`);
@@ -873,7 +873,7 @@ exports[`Portal: Props validation target must be a valid selector 2 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block2 = createBlock(\`<div>2</div>\`);
@@ -894,8 +894,8 @@ exports[`Portal: UI/UX focus is kept across re-renders 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
const Portal = app.Portal;
const comp1 = app.createComponent(\`Child\`, true, false, false);
const comp2 = app.createComponent(null, false, true, false);
const comp1 = app.createComponent(\`Child\`, true, false, false, false);
const comp2 = app.createComponent(null, false, true, false, false);
let block1 = createBlock(\`<div><block-child-0/></div>\`);