Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Dedupe Apollo Client 3 references in merge
function dedupeReferences (existing, incoming) {
// Dedupe items
const idMap = {}
for (const item of existing) {
idMap[item.__ref] = true
const validated = []
for (const item of incoming) {
if (!idMap[item.__ref]) {
return [...existing, ...validated]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment