From: 三咲智子 Kevin Deng Date: Sat, 25 Nov 2023 19:24:12 +0000 (+0800) Subject: fix: root X-Git-Tag: v3.6.0-alpha.1~16^2~811 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1e5bee7d5ee4bd2cac3abd59b8e11a489770564;p=thirdparty%2Fvuejs%2Fcore.git fix: root --- diff --git a/packages/compiler-vapor/__tests__/__snapshots__/compile.test.ts.snap b/packages/compiler-vapor/__tests__/__snapshots__/compile.test.ts.snap index 3c48100962..3cf060766c 100644 --- a/packages/compiler-vapor/__tests__/__snapshots__/compile.test.ts.snap +++ b/packages/compiler-vapor/__tests__/__snapshots__/compile.test.ts.snap @@ -13,7 +13,7 @@ export function render() { 1: [n3], }, ], - } = children(root); + } = children(n0); const n2 = createTextNode(count.value); insert(n2, n1, n3); watchEffect(() => { @@ -32,7 +32,7 @@ export function render() { const n0 = t0(); const { 0: [n1], - } = children(root); + } = children(n0); watchEffect(() => { setAttr(n1, 'id', undefined, id.value); }); @@ -49,7 +49,7 @@ export function render() { const n0 = t0(); const { 0: [n1], - } = children(root); + } = children(n0); watchEffect(() => { setHtml(n1, undefined, ''); }); @@ -66,7 +66,7 @@ export function render() { const n0 = t0(); const { 0: [n1], - } = children(root); + } = children(n0); watchEffect(() => { setHtml(n1, undefined, code.value); }); @@ -83,7 +83,7 @@ export function render() { const n0 = t0(); const { 0: [n1], - } = children(root); + } = children(n0); watchEffect(() => { on(n1, 'click', handleClick); }); @@ -100,7 +100,7 @@ export function render() { const n0 = t0(); const { 0: [n1], - } = children(root); + } = children(n0); watchEffect(() => { setAttr(n1, 'id', undefined, foo); }); @@ -121,7 +121,7 @@ export function render() { 1: [n3], }, ], - } = children(root); + } = children(n0); const n2 = createTextNode(msg.value); insert(n2, n1, 0 /* InsertPosition.FIRST */); setText(n2, undefined, msg.value); @@ -139,7 +139,7 @@ export function render() { const n0 = t0(); const { 0: [n1], - } = children(root); + } = children(n0); watchEffect(() => { setText(n1, undefined, ''); }); @@ -156,7 +156,7 @@ export function render() { const n0 = t0(); const { 0: [n1], - } = children(root); + } = children(n0); watchEffect(() => { setText(n1, undefined, str.value); }); diff --git a/packages/compiler-vapor/__tests__/__snapshots__/fixtures.test.ts.snap b/packages/compiler-vapor/__tests__/__snapshots__/fixtures.test.ts.snap index b60215ff8a..ea13872b7a 100644 --- a/packages/compiler-vapor/__tests__/__snapshots__/fixtures.test.ts.snap +++ b/packages/compiler-vapor/__tests__/__snapshots__/fixtures.test.ts.snap @@ -20,7 +20,7 @@ const increment = () => count.value++ return (() => { const n0 = t0() -const { 1: [n1], 2: [n3], 3: [n5], 4: [n6], 6: [n7],} = children(root) +const { 1: [n1], 2: [n3], 3: [n5], 4: [n6], 6: [n7],} = children(n0) const n2 = createTextNode(count.value) insert(n2, n1) const n4 = createTextNode(double.value) diff --git a/packages/compiler-vapor/src/generate.ts b/packages/compiler-vapor/src/generate.ts index c8e2f9e625..baac961ab3 100644 --- a/packages/compiler-vapor/src/generate.ts +++ b/packages/compiler-vapor/src/generate.ts @@ -30,7 +30,9 @@ export function generate( { code += `const n${ir.children.id} = t0()\n` if (Object.keys(ir.children.children).length) { - code += `const {${genChildren(ir.children.children)}} = children(root)\n` + code += `const {${genChildren(ir.children.children)}} = children(n${ + ir.children.id + })\n` vaporHelpers.add('children') }