From 12c7949132f7e6d7fcde8ead198b2093a9e9dd99 Mon Sep 17 00:00:00 2001 From: pimlie Date: Fri, 8 Mar 2019 13:22:43 +0100 Subject: [PATCH] fix: dont updateTags when the new info is not an array --- src/client/updateClientMetaInfo.js | 6 ++++++ src/client/updaters/tag.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/updateClientMetaInfo.js b/src/client/updateClientMetaInfo.js index e7bb46ad..b0bf87c0 100644 --- a/src/client/updateClientMetaInfo.js +++ b/src/client/updateClientMetaInfo.js @@ -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, diff --git a/src/client/updaters/tag.js b/src/client/updaters/tag.js index 7167d8ba..5b28ff9e 100644 --- a/src/client/updaters/tag.js +++ b/src/client/updaters/tag.js @@ -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')