diff --git a/deploy/datasets/query.js b/deploy/datasets/query.js index e89cc3d082abbebb3067aa363fbd53c08d2374e4..69116f2b474d166801583b07450b6a1de5013fe4 100644 --- a/deploy/datasets/query.js +++ b/deploy/datasets/query.js @@ -126,8 +126,18 @@ const getDs = ({ user }) => (user /** * remove duplicates */ - const currSet = new Set(acc.map(v => v['fullId'])) - if (currSet.has(curr['fullId'])) return [...acc] + const existingEntryIdx = acc.findIndex(v => v['fullId'] === curr['fullId']) + if (existingEntryIdx >= 0) { + const returnArr = [...acc].splice(existingEntryIdx, 1, { + ...acc[existingEntryIdx], + ...curr, + parcellationRegion: [ + ...(curr['parcellationRegion'] || []), + ...(acc[existingEntryIdx]['parcellationRegion'] || []) + ] + }) + return returnArr + } else return acc.concat(curr) }, []) })