mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-25 07:50:33 +03:00
fix: dont updateTags when the new info is not an array
This commit is contained in:
committed by
Alexander Lichter
parent
4fc67df86a
commit
12c7949132
@@ -1,5 +1,6 @@
|
|||||||
import { metaInfoOptionKeys, metaInfoAttributeKeys } from '../shared/constants'
|
import { metaInfoOptionKeys, metaInfoAttributeKeys } from '../shared/constants'
|
||||||
import { updateAttribute, updateTag, updateTitle } from './updaters'
|
import { updateAttribute, updateTag, updateTitle } from './updaters'
|
||||||
|
import isArray from '../shared/isArray'
|
||||||
|
|
||||||
const getTag = (tags, tag) => {
|
const getTag = (tags, tag) => {
|
||||||
if (!tags[tag]) {
|
if (!tags[tag]) {
|
||||||
@@ -46,6 +47,11 @@ export default function updateClientMetaInfo(options = {}, newInfo) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tags should always be an array, ignore if it isnt
|
||||||
|
if (!isArray(newInfo[type])) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
const { oldTags, newTags } = updateTag(
|
const { oldTags, newTags } = updateTag(
|
||||||
options,
|
options,
|
||||||
type,
|
type,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function updateTag({ attribute, tagIDKeyName } = {}, type, tags,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tags && tags.length) {
|
if (tags.length) {
|
||||||
tags.forEach((tag) => {
|
tags.forEach((tag) => {
|
||||||
const newElement = document.createElement(type)
|
const newElement = document.createElement(type)
|
||||||
newElement.setAttribute(attribute, 'true')
|
newElement.setAttribute(attribute, 'true')
|
||||||
|
|||||||
Reference in New Issue
Block a user