Skip to content

Commit c563318

Browse files
authored
Merge branch 'main' into optimize-reactive-judgment
2 parents 5296b8e + f66a75e commit c563318

File tree

19 files changed

+172
-45
lines changed

19 files changed

+172
-45
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## [3.4.21](https://github.com/vuejs/core/compare/v3.4.20...v3.4.21) (2024-02-28)
2+
3+
4+
### Bug Fixes
5+
6+
* **runtime-dom:** avoid unset option's value ([#10416](https://github.com/vuejs/core/issues/10416)) ([b3f8b5a](https://github.com/vuejs/core/commit/b3f8b5a4e700d4c47a146b6040882287d180f6cb)), closes [#10412](https://github.com/vuejs/core/issues/10412) [#10396](https://github.com/vuejs/core/issues/10396)
7+
* **suspense:** ensure nested suspense patching if in fallback state ([#10417](https://github.com/vuejs/core/issues/10417)) ([7c97778](https://github.com/vuejs/core/commit/7c97778aec1e3513035e5df265e1b8a7801f6106)), closes [#10415](https://github.com/vuejs/core/issues/10415)
8+
* **warning:** stringify args in warn handler ([#10414](https://github.com/vuejs/core/issues/10414)) ([bc37258](https://github.com/vuejs/core/commit/bc37258caa2f6f67f4554ab8587aca3798d92124)), closes [#10409](https://github.com/vuejs/core/issues/10409)
9+
10+
11+
112
## [3.4.20](https://github.com/vuejs/core/compare/v3.4.19...v3.4.20) (2024-02-26)
213

314

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"packageManager": "[email protected]",
55
"type": "module",
66
"scripts": {

packages/compiler-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-core",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",

packages/compiler-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-dom",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "@vue/compiler-dom",
55
"main": "index.js",
66
"module": "dist/compiler-dom.esm-bundler.js",

packages/compiler-sfc/__tests__/compileScript/__snapshots__/importUsageCheck.spec.ts.snap

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,6 @@ return { get FooBar() { return FooBar }, get foo() { return foo }, get bar() { r
7979
})"
8080
`;
8181

82-
exports[`import namespace 1`] = `
83-
"import { defineComponent as _defineComponent } from 'vue'
84-
import * as Foo from './foo'
85-
86-
export default /*#__PURE__*/_defineComponent({
87-
setup(__props, { expose: __expose }) {
88-
__expose();
89-
90-
91-
return { get Foo() { return Foo } }
92-
}
93-
94-
})"
95-
`;
96-
9782
exports[`js template string interpolations 1`] = `
9883
"import { defineComponent as _defineComponent } from 'vue'
9984
import { VAR, VAR2, VAR3 } from './x'

packages/compiler-sfc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-sfc",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-ssr",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "@vue/compiler-ssr",
55
"main": "dist/compiler-ssr.cjs.js",
66
"types": "dist/compiler-ssr.d.ts",

packages/reactivity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/reactivity",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "@vue/reactivity",
55
"main": "index.js",
66
"module": "dist/reactivity.esm-bundler.js",

packages/runtime-core/__tests__/components/Suspense.spec.ts

Lines changed: 127 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ describe('Suspense', () => {
5454
}
5555
}
5656

57+
const RouterView = {
58+
setup(_: any, { slots }: any) {
59+
const route = inject('route') as any
60+
const depth = inject('depth', 0)
61+
provide('depth', depth + 1)
62+
return () => {
63+
const current = route.value[depth]
64+
return slots.default({ Component: current })[0]
65+
}
66+
},
67+
}
68+
5769
test('fallback content', async () => {
5870
const Async = defineAsyncComponent({
5971
render() {
@@ -1041,18 +1053,6 @@ describe('Suspense', () => {
10411053

10421054
// #10098
10431055
test('switching branches w/ nested suspense', async () => {
1044-
const RouterView = {
1045-
setup(_: any, { slots }: any) {
1046-
const route = inject('route') as any
1047-
const depth = inject('depth', 0)
1048-
provide('depth', depth + 1)
1049-
return () => {
1050-
const current = route.value[depth]
1051-
return slots.default({ Component: current })[0]
1052-
}
1053-
},
1054-
}
1055-
10561056
const OuterB = defineAsyncComponent({
10571057
setup: () => {
10581058
return () =>
@@ -1132,6 +1132,121 @@ describe('Suspense', () => {
11321132
expect(serializeInner(root)).toBe(`<div>innerA</div>`)
11331133
})
11341134

1135+
// #10415
1136+
test('nested suspense (w/ suspensible) switch several times before parent suspense resolve', async () => {
1137+
const OuterA = defineAsyncComponent({
1138+
setup: () => {
1139+
return () =>
1140+
h(RouterView, null, {
1141+
default: ({ Component }: any) => [
1142+
h(Suspense, null, {
1143+
default: () => h(Component),
1144+
}),
1145+
],
1146+
})
1147+
},
1148+
})
1149+
1150+
const InnerA = defineAsyncComponent({
1151+
setup: () => {
1152+
return () => h('div', 'innerA')
1153+
},
1154+
})
1155+
1156+
const route = shallowRef([OuterA, InnerA])
1157+
const InnerB = defineAsyncComponent(
1158+
{
1159+
setup: () => {
1160+
return () => h('div', 'innerB')
1161+
},
1162+
},
1163+
5,
1164+
)
1165+
1166+
const InnerB1 = defineAsyncComponent(
1167+
{
1168+
setup: () => {
1169+
return () => h('div', 'innerB1')
1170+
},
1171+
},
1172+
5,
1173+
)
1174+
1175+
const InnerB2 = defineAsyncComponent(
1176+
{
1177+
setup: () => {
1178+
return () => h('div', 'innerB2')
1179+
},
1180+
},
1181+
5,
1182+
)
1183+
1184+
const OuterB = defineAsyncComponent(
1185+
{
1186+
setup() {
1187+
nextTick(async () => {
1188+
await new Promise(resolve => setTimeout(resolve, 1))
1189+
route.value = [OuterB, InnerB1]
1190+
})
1191+
1192+
nextTick(async () => {
1193+
await new Promise(resolve => setTimeout(resolve, 1))
1194+
route.value = [OuterB, InnerB2]
1195+
})
1196+
1197+
return () =>
1198+
h(RouterView, null, {
1199+
default: ({ Component }: any) => [
1200+
h(
1201+
Suspense,
1202+
{ suspensible: true },
1203+
{
1204+
default: () => h(Component),
1205+
},
1206+
),
1207+
],
1208+
})
1209+
},
1210+
},
1211+
5,
1212+
)
1213+
1214+
const Comp = {
1215+
setup() {
1216+
provide('route', route)
1217+
return () =>
1218+
h(RouterView, null, {
1219+
default: ({ Component }: any) => [
1220+
h(Suspense, null, {
1221+
default: () => h(Component),
1222+
}),
1223+
],
1224+
})
1225+
},
1226+
}
1227+
1228+
const root = nodeOps.createElement('div')
1229+
render(h(Comp), root)
1230+
await Promise.all(deps)
1231+
await nextTick()
1232+
expect(serializeInner(root)).toBe(`<!---->`)
1233+
1234+
await Promise.all(deps)
1235+
await nextTick()
1236+
expect(serializeInner(root)).toBe(`<div>innerA</div>`)
1237+
1238+
deps.length = 0
1239+
1240+
route.value = [OuterB, InnerB]
1241+
await nextTick()
1242+
1243+
await Promise.all(deps)
1244+
await Promise.all(deps)
1245+
await Promise.all(deps)
1246+
await nextTick()
1247+
expect(serializeInner(root)).toBe(`<div>innerB2</div>`)
1248+
})
1249+
11351250
test('branch switch to 3rd branch before resolve', async () => {
11361251
const calls: string[] = []
11371252

packages/runtime-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/runtime-core",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "@vue/runtime-core",
55
"main": "index.js",
66
"module": "dist/runtime-core.esm-bundler.js",

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ export const SuspenseImpl = {
9999
// 2. mounting along with the pendingBranch of parentSuspense
100100
// it is necessary to skip the current patch to avoid multiple mounts
101101
// of inner components.
102-
if (parentSuspense && parentSuspense.deps > 0) {
102+
if (
103+
parentSuspense &&
104+
parentSuspense.deps > 0 &&
105+
!n1.suspense!.isInFallback
106+
) {
103107
n2.suspense = n1.suspense!
104108
n2.suspense.vnode = n2
105109
n2.el = n1.el

packages/runtime-core/src/warning.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function warn(msg: string, ...args: any[]) {
4545
instance,
4646
ErrorCodes.APP_WARN_HANDLER,
4747
[
48-
msg + args.join(''),
48+
msg + args.map(a => a.toString?.() ?? JSON.stringify(a)).join(''),
4949
instance && instance.proxy,
5050
trace
5151
.map(

packages/runtime-dom/__tests__/patchProps.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,18 @@ describe('runtime-dom: props patching', () => {
291291
expect(el.value).toBe('baz')
292292
})
293293

294+
test('init empty value for option', () => {
295+
const root = document.createElement('div')
296+
render(
297+
h('select', { value: 'foo' }, [h('option', { value: '' }, 'foo')]),
298+
root,
299+
)
300+
const select = root.children[0] as HTMLSelectElement
301+
const option = select.children[0] as HTMLOptionElement
302+
expect(select.value).toBe('')
303+
expect(option.value).toBe('')
304+
})
305+
294306
// #8780
295307
test('embedded tag with width and height', () => {
296308
// Width and height of some embedded element such as img、video、source、canvas

packages/runtime-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/runtime-dom",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "@vue/runtime-dom",
55
"main": "index.js",
66
"module": "dist/runtime-dom.esm-bundler.js",

packages/runtime-dom/src/modules/props.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ export function patchDOMProp(
3434
// custom elements may use _value internally
3535
!tag.includes('-')
3636
) {
37-
// store value as _value as well since
38-
// non-string values will be stringified.
39-
el._value = value
4037
// #4956: <option> value will fallback to its text content so we need to
4138
// compare against its attribute value instead.
4239
const oldValue =
4340
tag === 'OPTION' ? el.getAttribute('value') || '' : el.value
4441
const newValue = value == null ? '' : value
45-
if (oldValue !== newValue) {
42+
if (oldValue !== newValue || !('_value' in el)) {
4643
el.value = newValue
4744
}
4845
if (value == null) {
4946
el.removeAttribute(key)
5047
}
48+
// store value as _value as well since
49+
// non-string values will be stringified.
50+
el._value = value
5151
return
5252
}
5353

packages/server-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/server-renderer",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "@vue/server-renderer",
55
"main": "index.js",
66
"module": "dist/server-renderer.esm-bundler.js",

packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/shared",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "internal utils shared across @vue packages",
55
"main": "index.js",
66
"module": "dist/shared.esm-bundler.js",

packages/vue-compat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compat",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "Vue 3 compatibility build for Vue 2",
55
"main": "index.js",
66
"module": "dist/vue.runtime.esm-bundler.js",

packages/vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue",
3-
"version": "3.4.20",
3+
"version": "3.4.21",
44
"description": "The progressive JavaScript framework for building modern web UI.",
55
"main": "index.js",
66
"module": "dist/vue.runtime.esm-bundler.js",

0 commit comments

Comments
 (0)