From bb325d5f1f0fa08a16dbe528525a2633e8dce2f6 Mon Sep 17 00:00:00 2001 From: Matt Black Date: Thu, 3 May 2018 12:49:51 -0400 Subject: [PATCH] prevent links from getting added twice --- LinkDirective.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LinkDirective.js b/LinkDirective.js index 135170d..55b84dd 100644 --- a/LinkDirective.js +++ b/LinkDirective.js @@ -83,6 +83,11 @@ export default class LinkDirective extends SchemaDirectiveVisitor { } } + // Check if a link already exists. + // This should be beefed up to check all the ways it could be a different link. + if (thisCollection.__links && thisCollection.__links[field.name]) { + return + }; thisCollection.addLinks({ [field.name]: { collection: referencedCollection,