Skip to content

Commit 88681b1

Browse files
authored
Merge branch 'vuejs:main' into main
2 parents 6dcbb8b + 423b462 commit 88681b1

37 files changed

+294
-93
lines changed

.github/workflows/size-report.yml

+10-14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ permissions:
1313

1414
env:
1515
PUPPETEER_SKIP_DOWNLOAD: 'true'
16+
COMMENT_MARKER: <!-- VUE_CORE_SIZE -->
1617

1718
jobs:
1819
size-report:
@@ -52,20 +53,15 @@ jobs:
5253
path: temp/size-prev
5354
if_no_artifact_found: warn
5455

55-
- name: Compare size
56-
run: pnpm tsx scripts/size-report.ts > size-report.md
57-
58-
- name: Read Size Report
59-
id: size-report
60-
uses: juliangruber/read-file-action@v1
61-
with:
62-
path: ./size-report.md
56+
- name: Prepare report
57+
run: |
58+
pnpm tsx scripts/size-report.ts > size-report.md
59+
echo '${{ env.COMMENT_MARKER }}' >> size-report.md
6360
6461
- name: Create Comment
65-
uses: actions-cool/maintain-one-comment@v3
62+
uses: thollander/actions-[email protected]
6663
with:
67-
token: ${{ secrets.GITHUB_TOKEN }}
68-
body: |
69-
${{ steps.size-report.outputs.content }}
70-
<!-- VUE_CORE_SIZE -->
71-
body-include: '<!-- VUE_CORE_SIZE -->'
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
filePath: size-report.md
66+
comment_tag: ${{ env.COMMENT_MARKER }}
67+
pr_number: ${{ github.event.workflow_run.pull_requests[0].number }}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"version": "3.4.29",
3+
"version": "3.4.30",
44
"packageManager": "[email protected]",
55
"type": "module",
66
"scripts": {

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/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-core",
3-
"version": "3.4.29",
3+
"version": "3.4.30",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",

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-dom/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-dom",
3-
"version": "3.4.29",
3+
"version": "3.4.30",
44
"description": "@vue/compiler-dom",
55
"main": "index.js",
66
"module": "dist/compiler-dom.esm-bundler.js",

packages/compiler-sfc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-sfc",
3-
"version": "3.4.29",
3+
"version": "3.4.30",
44
"description": "@vue/compiler-sfc",
55
"main": "dist/compiler-sfc.cjs.js",
66
"module": "dist/compiler-sfc.esm-browser.js",

packages/compiler-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-ssr",
3-
"version": "3.4.29",
3+
"version": "3.4.30",
44
"description": "@vue/compiler-ssr",
55
"main": "dist/compiler-ssr.cjs.js",
66
"types": "dist/compiler-ssr.d.ts",

packages/reactivity/__tests__/computed.spec.ts

+57
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,63 @@ describe('reactivity/computed', () => {
708708
expect(COMPUTED_SIDE_EFFECT_WARN).toHaveBeenWarned()
709709
})
710710

711+
it('should chained computeds keep reactivity when computed effect happens', async () => {
712+
const v = ref('Hello')
713+
const c = computed(() => {
714+
v.value += ' World'
715+
return v.value
716+
})
717+
const d = computed(() => c.value)
718+
const e = computed(() => d.value)
719+
const Comp = {
720+
setup: () => {
721+
return () => d.value + ' | ' + e.value
722+
},
723+
}
724+
const root = nodeOps.createElement('div')
725+
726+
render(h(Comp), root)
727+
await nextTick()
728+
expect(serializeInner(root)).toBe('Hello World | Hello World')
729+
730+
v.value += ' World'
731+
await nextTick()
732+
expect(serializeInner(root)).toBe(
733+
'Hello World World World | Hello World World World',
734+
)
735+
expect(COMPUTED_SIDE_EFFECT_WARN).toHaveBeenWarned()
736+
})
737+
738+
it('should keep dirty level when side effect computed value changed', () => {
739+
const v = ref(0)
740+
const c = computed(() => {
741+
v.value += 1
742+
return v.value
743+
})
744+
const d = computed(() => {
745+
return { d: c.value }
746+
})
747+
748+
const Comp = {
749+
setup: () => {
750+
return () => {
751+
return [d.value.d, d.value.d]
752+
}
753+
},
754+
}
755+
756+
const root = nodeOps.createElement('div')
757+
render(h(Comp), root)
758+
759+
expect(d.value.d).toBe(1)
760+
expect(serializeInner(root)).toBe('11')
761+
expect(c.effect._dirtyLevel).toBe(
762+
DirtyLevels.MaybeDirty_ComputedSideEffect_Origin,
763+
)
764+
expect(d.effect._dirtyLevel).toBe(DirtyLevels.MaybeDirty_ComputedSideEffect)
765+
expect(COMPUTED_SIDE_EFFECT_WARN).toHaveBeenWarned()
766+
})
767+
711768
it('debug: onTrigger (ref)', () => {
712769
let events: DebuggerEvent[] = []
713770
const onTrigger = vi.fn((e: DebuggerEvent) => {

packages/reactivity/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/reactivity",
3-
"version": "3.4.29",
3+
"version": "3.4.30",
44
"description": "@vue/reactivity",
55
"main": "index.js",
66
"module": "dist/reactivity.esm-bundler.js",

packages/reactivity/src/computed.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ export class ComputedRefImpl<T> {
7171
get value() {
7272
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
7373
const self = toRaw(this)
74+
const lastDirtyLevel = self.effect._dirtyLevel
7475
if (
7576
(!self._cacheable || self.effect.dirty) &&
7677
hasChanged(self._value, (self._value = self.effect.run()!))
7778
) {
78-
triggerRefValue(self, DirtyLevels.Dirty)
79+
// keep dirty level when side effect computed's value changed
80+
if (lastDirtyLevel !== DirtyLevels.MaybeDirty_ComputedSideEffect) {
81+
triggerRefValue(self, DirtyLevels.Dirty)
82+
}
7983
}
8084
trackRefValue(self)
8185
if (

packages/reactivity/src/effect.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ export class ReactiveEffect<T = any> {
9393
if (
9494
dep.computed.effect._dirtyLevel ===
9595
DirtyLevels.MaybeDirty_ComputedSideEffect_Origin
96-
)
96+
) {
97+
resetTracking()
9798
return true
99+
}
98100
triggerComputed(dep.computed)
99101
if (this._dirtyLevel >= DirtyLevels.Dirty) {
100102
break
@@ -306,14 +308,19 @@ export function triggerEffects(
306308
) {
307309
pauseScheduling()
308310
for (const effect of dep.keys()) {
311+
// dep.get(effect) is very expensive, we need to calculate it lazily and reuse the result
312+
let tracking: boolean | undefined
313+
309314
if (!dep.computed && effect.computed) {
310-
if (dep.get(effect) === effect._trackId && effect._runnings > 0) {
315+
if (
316+
effect._runnings > 0 &&
317+
(tracking ??= dep.get(effect) === effect._trackId)
318+
) {
311319
effect._dirtyLevel = DirtyLevels.MaybeDirty_ComputedSideEffect_Origin
312320
continue
313321
}
314322
}
315-
// dep.get(effect) is very expensive, we need to calculate it lazily and reuse the result
316-
let tracking: boolean | undefined
323+
317324
if (
318325
effect._dirtyLevel < dirtyLevel &&
319326
(tracking ??= dep.get(effect) === effect._trackId)

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
@@ -35,8 +35,6 @@ import {
3535
triggerRef,
3636
} from '@vue/reactivity'
3737

38-
// reference: https://vue-composition-api-rfc.netlify.com/api.html#watch
39-
4038
describe('api: watch', () => {
4139
it('effect', async () => {
4240
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/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/runtime-core",
3-
"version": "3.4.29",
3+
"version": "3.4.30",
44
"description": "@vue/runtime-core",
55
"main": "index.js",
66
"module": "dist/runtime-core.esm-bundler.js",

0 commit comments

Comments
 (0)