Skip to content

Commit 7d06ca3

Browse files
committed
chore: Merge branch 'main' into minor
2 parents 524e660 + 582cd2e commit 7d06ca3

29 files changed

+659
-595
lines changed

.github/workflows/autofix.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ jobs:
1616
- name: Install pnpm
1717
uses: pnpm/[email protected]
1818

19-
- name: Set node version to 18
19+
- name: Install Node.js
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: 18
23-
cache: pnpm
22+
node-version-file: '.node-version'
23+
registry-url: 'https://registry.npmjs.org'
24+
cache: 'pnpm'
2425

2526
- run: pnpm install
2627

.github/workflows/canary-minor.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
- name: Install pnpm
2020
uses: pnpm/[email protected]
2121

22-
- name: Set node version to 18
22+
- name: Install Node.js
2323
uses: actions/setup-node@v4
2424
with:
25-
node-version: 18
25+
node-version-file: '.node-version'
2626
registry-url: 'https://registry.npmjs.org'
2727
cache: 'pnpm'
2828

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## [3.4.30](https://github.com/vuejs/core/compare/v3.4.29...v3.4.30) (2024-06-22)
2+
3+
4+
### Bug Fixes
5+
6+
* **compiler-core:** should not remove slot node with `v-else` ([#11150](https://github.com/vuejs/core/issues/11150)) ([e102670](https://github.com/vuejs/core/commit/e102670bde00417c3a5b0262c855b297c0e4169e))
7+
* **hydration:** fix css vars hydration mismatch false positive on attr-fallthrough ([#11190](https://github.com/vuejs/core/issues/11190)) ([7ad67ce](https://github.com/vuejs/core/commit/7ad67ced26e5f53a47cb42f4834496e4958cb53b)), closes [#11188](https://github.com/vuejs/core/issues/11188)
8+
* **hydration:** skip prop mismatch check for directives that mutate DOM in created ([3169c91](https://github.com/vuejs/core/commit/3169c914939d02a013b2938aff30dac8525923f8)), closes [#11189](https://github.com/vuejs/core/issues/11189)
9+
* **reactivity:** fix side effect computed dirty level ([#11183](https://github.com/vuejs/core/issues/11183)) ([3bd79e3](https://github.com/vuejs/core/commit/3bd79e3e5ed960fc42cbf77bc61a97d2c03557c0)), closes [#11181](https://github.com/vuejs/core/issues/11181) [#11169](https://github.com/vuejs/core/issues/11169)
10+
* **runtime-core:** ensure unmount dynamic components in optimized mode ([#11171](https://github.com/vuejs/core/issues/11171)) ([220fe24](https://github.com/vuejs/core/commit/220fe247484209e62c7f4991902c5335e29c5007)), closes [#11168](https://github.com/vuejs/core/issues/11168)
11+
* **runtime-core:** update devtool __vnode on patch, avoid memory leak during dev ([a959781](https://github.com/vuejs/core/commit/a959781dd6f609dcb6f16dd7fa47d3b16895e5ca)), closes [#11192](https://github.com/vuejs/core/issues/11192)
12+
* **runtime-dom:** ensure only symbols are explicitly stringified during attribute patching ([#11182](https://github.com/vuejs/core/issues/11182)) ([a2e35d6](https://github.com/vuejs/core/commit/a2e35d682db15a592f4270bb0cde70a0e7bdc4a6)), closes [#11177](https://github.com/vuejs/core/issues/11177)
13+
* **runtime-dom:** prevent setting state as attribute for custom elements ([#11165](https://github.com/vuejs/core/issues/11165)) ([8ae4c29](https://github.com/vuejs/core/commit/8ae4c293adcec28f18114cb6016230a86787e6a9)), closes [#11163](https://github.com/vuejs/core/issues/11163)
14+
15+
16+
### Performance Improvements
17+
18+
* **reactivity:** cache tracking value ([#11145](https://github.com/vuejs/core/issues/11145)) ([7936dae](https://github.com/vuejs/core/commit/7936daebceab2ae9461c3b8f256e51020fb7d3ed))
19+
20+
21+
122
## [3.4.29](https://github.com/vuejs/core/compare/v3.4.28...v3.4.29) (2024-06-14)
223

324

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"version": "3.5.0-alpha.2",
4-
"packageManager": "pnpm@9.2.0",
4+
"packageManager": "pnpm@9.3.0",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
@@ -67,35 +67,35 @@
6767
"@rollup/plugin-json": "^6.1.0",
6868
"@rollup/plugin-node-resolve": "^15.2.3",
6969
"@rollup/plugin-replace": "5.0.4",
70-
"@rollup/plugin-terser": "^0.4.4",
70+
"@swc/core": "^1.6.1",
7171
"@types/hash-sum": "^1.0.2",
7272
"@types/minimist": "^1.2.5",
7373
"@types/node": "^20.14.2",
7474
"@types/semver": "^7.5.8",
75-
"@vitest/coverage-istanbul": "^1.5.2",
75+
"@vitest/coverage-istanbul": "^1.6.0",
7676
"@vue/consolidate": "1.0.0",
7777
"conventional-changelog-cli": "^4.1.0",
7878
"enquirer": "^2.4.1",
7979
"esbuild": "^0.21.5",
8080
"esbuild-plugin-polyfill-node": "^0.3.0",
81-
"eslint": "^9.4.0",
81+
"eslint": "^9.5.0",
8282
"eslint-plugin-import-x": "^0.5.1",
8383
"eslint-plugin-vitest": "^0.5.4",
8484
"estree-walker": "^2.0.2",
8585
"execa": "^9.2.0",
86-
"jsdom": "^24.0.0",
87-
"lint-staged": "^15.2.5",
86+
"jsdom": "^24.1.0",
87+
"lint-staged": "^15.2.7",
8888
"lodash": "^4.17.21",
8989
"magic-string": "^0.30.10",
9090
"markdown-table": "^3.0.3",
9191
"marked": "^12.0.2",
9292
"minimist": "^1.2.8",
9393
"npm-run-all2": "^6.2.0",
9494
"picocolors": "^1.0.1",
95-
"prettier": "^3.3.1",
95+
"prettier": "^3.3.2",
9696
"pretty-bytes": "^6.1.1",
9797
"pug": "^3.0.3",
98-
"puppeteer": "~22.7.1",
98+
"puppeteer": "~22.11.0",
9999
"rimraf": "^5.0.7",
100100
"rollup": "^4.18.0",
101101
"rollup-plugin-dts": "^6.1.1",
@@ -107,11 +107,11 @@
107107
"terser": "^5.31.1",
108108
"todomvc-app-css": "^2.4.3",
109109
"tslib": "^2.6.3",
110-
"tsx": "^4.15.1",
110+
"tsx": "^4.15.5",
111111
"typescript": "~5.4.5",
112-
"typescript-eslint": "^7.12.0",
113-
"vite": "^5.2.13",
114-
"vitest": "^1.5.2"
112+
"typescript-eslint": "^7.13.0",
113+
"vite": "^5.3.1",
114+
"vitest": "^1.6.0"
115115
},
116116
"pnpm": {
117117
"peerDependencyRules": {

packages/compiler-core/__tests__/transforms/vSlot.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ describe('compiler: transform component slots', () => {
696696
expect((root as any).children[0].codegenNode.patchFlag).toMatch(
697697
PatchFlags.DYNAMIC_SLOTS + '',
698698
)
699+
expect((root as any).children[0].children.length).toBe(3)
699700
expect(generate(root).code).toMatchSnapshot()
700701
})
701702

packages/compiler-core/src/compat/transformFilter.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ export const transformFilter: NodeTransform = (node, context) => {
2525
// filter rewrite is applied before expression transform so only
2626
// simple expressions are possible at this stage
2727
rewriteFilter(node.content, context)
28-
}
29-
30-
if (node.type === NodeTypes.ELEMENT) {
28+
} else if (node.type === NodeTypes.ELEMENT) {
3129
node.props.forEach((prop: AttributeNode | DirectiveNode) => {
3230
if (
3331
prop.type === NodeTypes.DIRECTIVE &&

packages/compiler-core/src/transforms/vSlot.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,7 @@ export function buildSlots(
226226
break
227227
}
228228
}
229-
if (prev && isTemplateNode(prev) && findDir(prev, 'if')) {
230-
// remove node
231-
children.splice(i, 1)
232-
i--
229+
if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
233230
__TEST__ && assert(dynamicSlots.length > 0)
234231
// attach this slot to previous conditional
235232
let conditional = dynamicSlots[

packages/compiler-sfc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@
6262
"postcss-modules": "^6.0.0",
6363
"postcss-selector-parser": "^6.1.0",
6464
"pug": "^3.0.3",
65-
"sass": "^1.77.4"
65+
"sass": "^1.77.5"
6666
}
6767
}

packages/reactivity/__tests__/computed.spec.ts

+51
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,57 @@ describe('reactivity/computed', () => {
853853
expect(calls).toMatchObject(['b eval', 'mounted', 'b eval'])
854854
})
855855

856+
it('should chained computeds keep reactivity when computed effect happens', async () => {
857+
const v = ref('Hello')
858+
const c = computed(() => {
859+
v.value += ' World'
860+
return v.value
861+
})
862+
const d = computed(() => c.value)
863+
const e = computed(() => d.value)
864+
const Comp = {
865+
setup: () => {
866+
return () => d.value + ' | ' + e.value
867+
},
868+
}
869+
const root = nodeOps.createElement('div')
870+
871+
render(h(Comp), root)
872+
await nextTick()
873+
expect(serializeInner(root)).toBe('Hello World | Hello World')
874+
875+
v.value += ' World'
876+
await nextTick()
877+
expect(serializeInner(root)).toBe(
878+
'Hello World World World | Hello World World World',
879+
)
880+
})
881+
882+
it('should keep dirty level when side effect computed value changed', () => {
883+
const v = ref(0)
884+
const c = computed(() => {
885+
v.value += 1
886+
return v.value
887+
})
888+
const d = computed(() => {
889+
return { d: c.value }
890+
})
891+
892+
const Comp = {
893+
setup: () => {
894+
return () => {
895+
return [d.value.d, d.value.d]
896+
}
897+
},
898+
}
899+
900+
const root = nodeOps.createElement('div')
901+
render(h(Comp), root)
902+
903+
expect(d.value.d).toBe(1)
904+
expect(serializeInner(root)).toBe('11')
905+
})
906+
856907
it('debug: onTrigger (ref)', () => {
857908
let events: DebuggerEvent[] = []
858909
const onTrigger = vi.fn((e: DebuggerEvent) => {

packages/runtime-core/__tests__/apiInject.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
} from '../src/index'
1414
import { createApp, nodeOps, render, serialize } from '@vue/runtime-test'
1515

16-
// reference: https://vue-composition-api-rfc.netlify.com/api.html#provide-inject
1716
describe('api: provide/inject', () => {
1817
it('string keys', () => {
1918
const Provider = {

packages/runtime-core/__tests__/apiLifecycle.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ import {
2424
TriggerOpTypes,
2525
} from '@vue/reactivity'
2626

27-
// reference: https://vue-composition-api-rfc.netlify.com/api.html#lifecycle-hooks
28-
2927
describe('api: lifecycle hooks', () => {
3028
it('onBeforeMount', () => {
3129
const root = nodeOps.createElement('div')

packages/runtime-core/__tests__/apiSetupContext.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import {
1212
watchEffect,
1313
} from '@vue/runtime-test'
1414

15-
// reference: https://vue-composition-api-rfc.netlify.com/api.html#setup
16-
1715
describe('api: setup context', () => {
1816
it('should expose return values to template render context', () => {
1917
const Comp = defineComponent({

packages/runtime-core/__tests__/apiWatch.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ import {
3636
triggerRef,
3737
} from '@vue/reactivity'
3838

39-
// reference: https://vue-composition-api-rfc.netlify.com/api.html#watch
40-
4139
describe('api: watch', () => {
4240
it('effect', async () => {
4341
const state = reactive({ count: 0 })

packages/runtime-core/__tests__/hydration.spec.ts

+41
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import {
6+
type ObjectDirective,
67
Suspense,
78
Teleport,
89
Transition,
@@ -1674,5 +1675,45 @@ describe('SSR hydration', () => {
16741675
app.mount(container)
16751676
expect(`Hydration style mismatch`).not.toHaveBeenWarned()
16761677
})
1678+
1679+
// #11188
1680+
test('css vars support fallthrough', () => {
1681+
const container = document.createElement('div')
1682+
container.innerHTML = `<div style="padding: 4px;--foo:red;"></div>`
1683+
const app = createSSRApp({
1684+
setup() {
1685+
useCssVars(() => ({
1686+
foo: 'red',
1687+
}))
1688+
return () => h(Child)
1689+
},
1690+
})
1691+
const Child = {
1692+
setup() {
1693+
return () => h('div', { style: 'padding: 4px' })
1694+
},
1695+
}
1696+
app.mount(container)
1697+
expect(`Hydration style mismatch`).not.toHaveBeenWarned()
1698+
})
1699+
1700+
// #11189
1701+
test('should not warn for directives that mutate DOM in created', () => {
1702+
const container = document.createElement('div')
1703+
container.innerHTML = `<div class="test red"></div>`
1704+
const vColor: ObjectDirective = {
1705+
created(el, binding) {
1706+
el.classList.add(binding.value)
1707+
},
1708+
}
1709+
const app = createSSRApp({
1710+
setup() {
1711+
return () =>
1712+
withDirectives(h('div', { class: 'test' }), [[vColor, 'red']])
1713+
},
1714+
})
1715+
app.mount(container)
1716+
expect(`Hydration style mismatch`).not.toHaveBeenWarned()
1717+
})
16771718
})
16781719
})

packages/runtime-core/__tests__/rendererOptimizedMode.spec.ts

+26
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,32 @@ describe('renderer: optimized mode', () => {
487487
expect(spy).toHaveBeenCalledTimes(1)
488488
})
489489

490+
test('should call onUnmounted hook for dynamic components receiving an existing vnode w/ component children', async () => {
491+
const spy = vi.fn()
492+
const show = ref(1)
493+
const Child = {
494+
setup() {
495+
onUnmounted(spy)
496+
return () => 'child'
497+
},
498+
}
499+
const foo = h('div', null, h(Child))
500+
const app = createApp({
501+
render() {
502+
return show.value
503+
? (openBlock(),
504+
createBlock('div', null, [(openBlock(), createBlock(foo))]))
505+
: createCommentVNode('v-if', true)
506+
},
507+
})
508+
509+
app.mount(root)
510+
show.value = 0
511+
await nextTick()
512+
513+
expect(spy).toHaveBeenCalledTimes(1)
514+
})
515+
490516
// #2444
491517
// `KEYED_FRAGMENT` and `UNKEYED_FRAGMENT` always need to diff its children
492518
test('non-stable Fragment always need to diff its children', () => {

packages/runtime-core/__tests__/rendererTemplateRef.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import {
1010
shallowRef,
1111
} from '@vue/runtime-test'
1212

13-
// reference: https://vue-composition-api-rfc.netlify.com/api.html#template-refs
14-
1513
describe('api: template refs', () => {
1614
it('string ref mount', () => {
1715
const root = nodeOps.createElement('div')

packages/runtime-core/src/components/Suspense.ts

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ export const SuspenseImpl = {
123123
}
124124
},
125125
hydrate: hydrateSuspense,
126-
create: createSuspenseBoundary,
127126
normalize: normalizeSuspenseChildren,
128127
}
129128

packages/runtime-core/src/components/Teleport.ts

-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ export const TeleportImpl = {
250250
vnode: VNode,
251251
parentComponent: ComponentInternalInstance | null,
252252
parentSuspense: SuspenseBoundary | null,
253-
optimized: boolean,
254253
{ um: unmount, o: { remove: hostRemove } }: RendererInternals,
255254
doRemove: boolean,
256255
) {

0 commit comments

Comments
 (0)