feature/IO-3000-messaging-sockets-migrations2 -

- A lot of a lot of testing....

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-11-21 22:14:39 -08:00
parent 141deff41e
commit 6504b27eca
5 changed files with 376 additions and 249 deletions

View File

@@ -162,6 +162,22 @@ const cache = new InMemoryCache({
(incomingItem) => !existing.some((existingItem) => existingItem.__ref === incomingItem.__ref)
)
];
return merged;
}
},
messages: {
keyArgs: false, // Ignore arguments when determining uniqueness (like `order_by`).
merge(existing = [], incoming = [], { readField }) {
const existingIds = new Set(existing.map((message) => readField("id", message)));
// Merge incoming messages, avoiding duplicates
const merged = [...existing];
incoming.forEach((message) => {
if (!existingIds.has(readField("id", message))) {
merged.push(message);
}
});
return merged;
}
}