Skip to content

Commit

Permalink
fix: 🐛 Check merge key for merge data source
Browse files Browse the repository at this point in the history
Adds a check to only reduce data when merge key is present
  • Loading branch information
igoroctaviano committed Jan 17, 2024
1 parent 9c553fd commit 77fcfb6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion extensions/default/src/MergeDataSource/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/**
Expand Down

0 comments on commit 77fcfb6

Please sign in to comment.