fix items not getting matched properly (#7666)

This commit is contained in:
Nitwel
2021-08-27 16:30:14 +02:00
committed by GitHub
parent 40f8d2ef99
commit 324b7331d1

View File

@@ -82,7 +82,10 @@ export default function usePreview(
// Replace existing items with it's updated counterparts
responseData = responseData
.map((item) => {
const updatedItem = updatedItems.find((updated) => updated[junctionPkField] === item[junctionPkField]);
const updatedItem = updatedItems.find(
(updated) =>
get(updated, [junctionField, junctionPkField]) === get(item, [junctionField, junctionPkField])
);
if (updatedItem !== undefined) return merge(item, updatedItem);
return item;
})