From 03584cacb22ded7ed0c4c0d957937a22350fe95a Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 12 Oct 2020 10:28:53 +0100 Subject: [PATCH] Using lodash flatten rather than pure JS. --- packages/server/src/db/linkedRecords/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/db/linkedRecords/index.js b/packages/server/src/db/linkedRecords/index.js index 842900f815..ba93f3d2e8 100644 --- a/packages/server/src/db/linkedRecords/index.js +++ b/packages/server/src/db/linkedRecords/index.js @@ -1,5 +1,6 @@ const LinkController = require("./LinkController") const { IncludeDocs, getLinkDocuments, createLinkView } = require("./linkUtils") +const _ = require("lodash") /** * This functionality makes sure that when records with links are created, updated or deleted they are processed @@ -90,8 +91,7 @@ exports.attachLinkInfo = async (instanceId, records) => { } let modelIds = [...new Set(records.map(el => el.modelId))] // start by getting all the link values for performance reasons - let responses = [].concat.apply( - [], + let responses = _.flatten( await Promise.all( modelIds.map(modelId => getLinkDocuments({