Skip to content

Commit 6aaf57e

Browse files
committed
Fix o2m update item cause duplicate ids
1 parent 61aa7f6 commit 6aaf57e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ export const useDeepValues = (
143143
arrayOfIds = arrayOfIds.concat(data);
144144
}
145145

146+
if (fieldChanges.update) {
147+
const updatedIds = fieldChanges.update.map(({ id }) => id);
148+
arrayOfIds = arrayOfIds.filter((id) => !updatedIds.includes(id));
149+
}
150+
146151
if (fieldChanges.delete) {
147152
arrayOfIds = arrayOfIds.filter((id) => !fieldChanges.delete!.includes(id));
148153
}
@@ -182,7 +187,7 @@ export const useDeepValues = (
182187
}
183188
}
184189

185-
// must concat after request, created items doenst have ids
190+
// must concat after request, created items doesn't have ids
186191
if (fieldChanges.create) {
187192
arrayOfData = arrayOfData.concat(fieldChanges.create);
188193
}

0 commit comments

Comments
 (0)