From 77fcfb6de11166e5773bfc4fffba7c6ae671e281 Mon Sep 17 00:00:00 2001 From: Igor Octaviano Date: Wed, 17 Jan 2024 11:12:30 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Check=20merge=20key=20for?= =?UTF-8?q?=20merge=20data=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a check to only reduce data when merge key is present --- extensions/default/src/MergeDataSource/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/default/src/MergeDataSource/index.ts b/extensions/default/src/MergeDataSource/index.ts index 1c14069b665..9db282e8220 100644 --- a/extensions/default/src/MergeDataSource/index.ts +++ b/extensions/default/src/MergeDataSource/index.ts @@ -60,7 +60,14 @@ export const callForAllDataSourcesAsync = async ({ await Promise.allSettled(promises); - return uniqBy(mergedData.flat(), obj => obj[mergeKey]); + let results = []; + if (mergeKey) { + results = uniqBy(mergedData.flat(), obj => get(obj, mergeKey)); + } else { + results = mergedData.flat(); + } + + return results; }; /**