From 82a584820fcd2e7705ea5eb4acc7fd357076bb30 Mon Sep 17 00:00:00 2001 From: Zollero Date: Tue, 25 Oct 2022 07:43:43 +0000 Subject: [PATCH 1/3] Exchange the order of `setScopeId` and `props initiate`, and update the test case --- packages/runtime-core/__tests__/scopeId.spec.ts | 2 +- packages/runtime-core/src/renderer.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/runtime-core/__tests__/scopeId.spec.ts b/packages/runtime-core/__tests__/scopeId.spec.ts index 606da2887cf..49f162db0ab 100644 --- a/packages/runtime-core/__tests__/scopeId.spec.ts +++ b/packages/runtime-core/__tests__/scopeId.spec.ts @@ -152,7 +152,7 @@ describe('scopeId runtime support', () => { const root2 = nodeOps.createElement('div') render(h(Root2), root2) expect(serializeInner(root2)).toBe( - `
` + + `
` + `
` + `
hoisted
` + `
dynamic
` + diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index c043492e1df..11c83f09df8 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -646,6 +646,8 @@ function baseCreateRenderer( if (dirs) { invokeDirectiveHook(vnode, null, parentComponent, 'created') } + // scopeId + setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent) // props if (props) { for (const key in props) { @@ -679,8 +681,6 @@ function baseCreateRenderer( invokeVNodeHook(vnodeHook, parentComponent, vnode) } } - // scopeId - setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent) if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) { Object.defineProperty(el, '__vnode', { From 1d25db4b731f9192e25db3afa7ced32a70cc2d2b Mon Sep 17 00:00:00 2001 From: Zollero Date: Tue, 25 Oct 2022 07:55:09 +0000 Subject: [PATCH 2/3] update the test case --- packages/runtime-core/__tests__/scopeId.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime-core/__tests__/scopeId.spec.ts b/packages/runtime-core/__tests__/scopeId.spec.ts index 49f162db0ab..8e5b4c362bf 100644 --- a/packages/runtime-core/__tests__/scopeId.spec.ts +++ b/packages/runtime-core/__tests__/scopeId.spec.ts @@ -126,7 +126,7 @@ describe('scopeId runtime support', () => { const root = nodeOps.createElement('div') render(h(Root), root) expect(serializeInner(root)).toBe( - `
` + + `
` + `
hoisted
` + `
dynamic
` + `
` From 27cc079e5f42db3e6cd56d4088935729472d077c Mon Sep 17 00:00:00 2001 From: Zollero Date: Tue, 25 Oct 2022 08:00:26 +0000 Subject: [PATCH 3/3] update the test case again! --- packages/runtime-core/__tests__/scopeId.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime-core/__tests__/scopeId.spec.ts b/packages/runtime-core/__tests__/scopeId.spec.ts index 8e5b4c362bf..cdbb81c4191 100644 --- a/packages/runtime-core/__tests__/scopeId.spec.ts +++ b/packages/runtime-core/__tests__/scopeId.spec.ts @@ -153,7 +153,7 @@ describe('scopeId runtime support', () => { render(h(Root2), root2) expect(serializeInner(root2)).toBe( `
` + - `
` + + `
` + `
hoisted
` + `
dynamic
` + `
` +