Skip to content

Commit 66579ea

Browse files
committed
chore: Merge branch 'main' into minor
2 parents 73ef156 + 422ef34 commit 66579ea

File tree

5 files changed

+30
-22
lines changed

5 files changed

+30
-22
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## [3.4.33](https://github.com/vuejs/core/compare/v3.4.32...v3.4.33) (2024-07-19)
2+
3+
4+
### Bug Fixes
5+
6+
* **runtime-dom:** handle undefined values in v-html ([#11403](https://github.com/vuejs/core/issues/11403)) ([5df67e3](https://github.com/vuejs/core/commit/5df67e36756639ea7b923d1b139d6cb14450123b))
7+
8+
9+
110
## [3.4.32](https://github.com/vuejs/core/compare/v3.4.31...v3.4.32) (2024-07-17)
211

312

packages/runtime-core/src/component.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,6 @@ export interface ComponentInternalInstance {
454454
refs: Data
455455
emit: EmitFn
456456

457-
attrsProxy: Data | null
458-
slotsProxy: Slots | null
459-
460457
/**
461458
* used for keeping track of .once event handlers on components
462459
* @internal
@@ -659,9 +656,6 @@ export function createComponentInstance(
659656
setupState: EMPTY_OBJ,
660657
setupContext: null,
661658

662-
attrsProxy: null,
663-
slotsProxy: null,
664-
665659
// suspense related
666660
suspense,
667661
suspenseId: suspense ? suspense.pendingId : 0,
@@ -1104,15 +1098,12 @@ const attrsProxyHandlers = __DEV__
11041098
* Dev-only
11051099
*/
11061100
function getSlotsProxy(instance: ComponentInternalInstance): Slots {
1107-
return (
1108-
instance.slotsProxy ||
1109-
(instance.slotsProxy = new Proxy(instance.slots, {
1110-
get(target, key: string) {
1111-
track(instance, TrackOpTypes.GET, '$slots')
1112-
return target[key]
1113-
},
1114-
}))
1115-
)
1101+
return new Proxy(instance.slots, {
1102+
get(target, key: string) {
1103+
track(instance, TrackOpTypes.GET, '$slots')
1104+
return target[key]
1105+
},
1106+
})
11161107
}
11171108

11181109
export function createSetupContext(
@@ -1146,6 +1137,7 @@ export function createSetupContext(
11461137
// We use getters in dev in case libs like test-utils overwrite instance
11471138
// properties (overwrites should not be done in prod)
11481139
let attrsProxy: Data
1140+
let slotsProxy: Slots
11491141
return Object.freeze({
11501142
get attrs() {
11511143
return (
@@ -1154,7 +1146,7 @@ export function createSetupContext(
11541146
)
11551147
},
11561148
get slots() {
1157-
return getSlotsProxy(instance)
1149+
return slotsProxy || (slotsProxy = getSlotsProxy(instance))
11581150
},
11591151
get emit() {
11601152
return (event: string, ...args: any[]) => instance.emit(event, ...args)

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ describe('runtime-dom: props patching', () => {
152152
expect(root.innerHTML).toBe(`<div><del>baz</del></div>`)
153153
})
154154

155+
test('patch innerHTML porp w/ undefined value', async () => {
156+
const root = document.createElement('div')
157+
render(h('div', { innerHTML: undefined }), root)
158+
expect(root.innerHTML).toBe(`<div></div>`)
159+
})
160+
155161
test('textContent unmount prev children', () => {
156162
const fn = vi.fn()
157163
const comp = {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function patchDOMProp(
1515
if (key === 'innerHTML' || key === 'textContent') {
1616
// null value case is handled in renderer patchElement before patching
1717
// children
18-
if (value === null) return
18+
if (value == null) return
1919
el[key] = value
2020
return
2121
}

scripts/utils.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ export function fuzzyMatchTarget(partialTargets, includeAllMatching) {
6060
*/
6161
export async function exec(command, args, options) {
6262
return new Promise((resolve, reject) => {
63-
const process = spawn(command, args, {
63+
const _process = spawn(command, args, {
6464
stdio: [
6565
'ignore', // stdin
6666
'pipe', // stdout
6767
'pipe', // stderr
6868
],
6969
...options,
70+
shell: process.platform === 'win32',
7071
})
7172

7273
/**
@@ -78,19 +79,19 @@ export async function exec(command, args, options) {
7879
*/
7980
const stdoutChunks = []
8081

81-
process.stderr?.on('data', chunk => {
82+
_process.stderr?.on('data', chunk => {
8283
stderrChunks.push(chunk)
8384
})
8485

85-
process.stdout?.on('data', chunk => {
86+
_process.stdout?.on('data', chunk => {
8687
stdoutChunks.push(chunk)
8788
})
8889

89-
process.on('error', error => {
90+
_process.on('error', error => {
9091
reject(error)
9192
})
9293

93-
process.on('exit', code => {
94+
_process.on('exit', code => {
9495
const ok = code === 0
9596
const stderr = Buffer.concat(stderrChunks).toString().trim()
9697
const stdout = Buffer.concat(stdoutChunks).toString().trim()

0 commit comments

Comments
 (0)