Skip to content

Commit 104113a

Browse files
pimlieTheAlexLichter
authored andcommitted
fix: use undefined as child ignore indicator
1 parent 915fedf commit 104113a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/shared/merge.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export function arrayMerge({ component, tagIDKeyName, metaTemplateKeyName, conte
2020

2121
// source doesnt contain any duplicate id's
2222
// or the source item should be ignored
23-
if (sourceIndex === -1 || sourceItem[contentKeyName] === false || sourceItem.innerHTML === false) {
23+
if (sourceIndex === -1 ||
24+
(sourceItem.hasOwnProperty(contentKeyName) && sourceItem[contentKeyName] === undefined) ||
25+
(sourceItem.hasOwnProperty('innerHTML') && sourceItem.innerHTML === undefined)
26+
) {
2427
destination.push(targetItem)
2528
return
2629
}
@@ -57,7 +60,7 @@ export function merge(target, source, options = {}) {
5760
// remove properties explicitly set to false so child components can
5861
// optionally _not_ overwrite the parents content
5962
// (for array properties this is checked in arrayMerge)
60-
if (source.title === false) {
63+
if (source.hasOwnProperty('title') && source.title === undefined) {
6164
delete source.title
6265
}
6366

@@ -67,7 +70,7 @@ export function merge(target, source, options = {}) {
6770
}
6871

6972
for (const key in source[attrKey]) {
70-
if (source[attrKey][key] === false) {
73+
if (source[attrKey].hasOwnProperty(key) && source[attrKey][key] === undefined) {
7174
delete source[attrKey][key]
7275
}
7376
}

test/getMetaInfo.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,11 @@ describe('getMetaInfo', () => {
622622
Vue.component('merge-child', {
623623
render: h => h('div'),
624624
metaInfo: {
625-
title: false,
625+
title: undefined,
626626
meta: [
627627
{
628628
vmid: 'og:title',
629-
content: false
629+
content: undefined
630630
}
631631
]
632632
}

0 commit comments

Comments
 (0)