2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-13 10:02:26 +03:00

Merge pull request #45 from jhaynie/master

Fixed issue with duplicate insertions
This commit is contained in:
Sébastien Chopin
2017-03-06 19:10:30 +01:00
committed by GitHub
+14
View File
@@ -18,6 +18,20 @@ export default function _updateTags (options = {}) {
const newTags = []
let indexToDelete
if (tags.length > 1) {
// remove duplicates that could have been found by merging tags
// which include a mixin with metaInfo and that mixin is used
// by multiple components on the same page
const found = []
tags = tags.map(x => {
const k = JSON.stringify(x)
if (found.indexOf(k) < 0) {
found.push(k)
return x
}
}).filter(x => x)
}
if (tags && tags.length) {
tags.forEach((tag) => {
const newElement = document.createElement(type)