2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-18 22:20:33 +03:00

fix: dont updateTags when the new info is not an array

This commit is contained in:
pimlie
2019-03-08 13:22:43 +01:00
committed by Alexander Lichter
parent 4fc67df86a
commit 12c7949132
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -1,5 +1,6 @@
import { metaInfoOptionKeys, metaInfoAttributeKeys } from '../shared/constants'
import { updateAttribute, updateTag, updateTitle } from './updaters'
import isArray from '../shared/isArray'
const getTag = (tags, tag) => {
if (!tags[tag]) {
@@ -46,6 +47,11 @@ export default function updateClientMetaInfo(options = {}, newInfo) {
continue
}
// tags should always be an array, ignore if it isnt
if (!isArray(newInfo[type])) {
continue
}
const { oldTags, newTags } = updateTag(
options,
type,
+1 -1
View File
@@ -26,7 +26,7 @@ export default function updateTag({ attribute, tagIDKeyName } = {}, type, tags,
})
}
if (tags && tags.length) {
if (tags.length) {
tags.forEach((tag) => {
const newElement = document.createElement(type)
newElement.setAttribute(attribute, 'true')