From f182a65547ea28c4efc80d0de0f6b834b321c146 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 3 Feb 2021 17:19:41 +0000 Subject: [PATCH] Adding a check to the link utils which should make sure the correct link doc is always picked. --- packages/server/src/db/linkedRows/linkUtils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/server/src/db/linkedRows/linkUtils.js b/packages/server/src/db/linkedRows/linkUtils.js index 6549f9b61b..cb669cf5c7 100644 --- a/packages/server/src/db/linkedRows/linkUtils.js +++ b/packages/server/src/db/linkedRows/linkUtils.js @@ -84,6 +84,13 @@ exports.getLinkDocuments = async function({ // filter to get unique entries const foundIds = [] linkRows = linkRows.filter(link => { + // make sure anything unique is the correct key + if ( + (tableId && link.key[0] !== tableId) || + (rowId && link.key[1] !== rowId) + ) { + return false + } const unique = foundIds.indexOf(link.id) === -1 if (unique) { foundIds.push(link.id)