Skip to content

Commit

Permalink
fix: dont updateTags when the new info is not an array
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie authored and manniL committed Mar 12, 2019
1 parent 4fc67df commit 12c7949
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/client/updateClientMetaInfo.js
Original file line number Diff line number Diff line change
@@ -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]) {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/client/updaters/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 12c7949

Please sign in to comment.