fix: ignore duplicated tags

This commit is contained in:
Luis Contreras 2020-10-09 01:21:44 +02:00
parent ff8dbcbfb7
commit cfabae56d7
2 changed files with 4 additions and 2 deletions

View file

@ -5,7 +5,8 @@ function sourceNodes({ actions, createNodeId, createContentDigest }) {
// Add People to the GraphQL API, we randomize the data on each build so no one gets their feelings hurt // Add People to the GraphQL API, we randomize the data on each build so no one gets their feelings hurt
people people
.sort(() => Math.random() - 0.5) .sort(() => Math.random() - 0.5)
.forEach(person => { .forEach(p => {
const person = { ...p, tags: [...new Set(p.tags)] };
const nodeMeta = { const nodeMeta = {
id: createNodeId(`person-${person.name}`), id: createNodeId(`person-${person.name}`),
parent: null, parent: null,

View file

@ -3,7 +3,8 @@ import people from '../data.js';
function merge(prop) { function merge(prop) {
return function(acc, obj) { return function(acc, obj) {
return [...obj[prop], ...acc]; const propEntries = [...new Set(obj[prop])];
return [...propEntries, ...acc];
}; };
} }