mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-23 06:45:22 -07:00
Update frontend/composables/use-shopping-list-item-actions.ts
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
parent
7d4be79c49
commit
4f23153dae
1 changed files with 6 additions and 6 deletions
|
@ -95,12 +95,12 @@ export function useShoppingListItemActions(shoppingListId: string) {
|
||||||
) {
|
) {
|
||||||
const mergedList = [...list1];
|
const mergedList = [...list1];
|
||||||
list2.forEach((list2Item) => {
|
list2.forEach((list2Item) => {
|
||||||
const confictingItem = mergedList.find((item) => item.id === list2Item.id)
|
const conflictingItem = mergedList.find((item) => item.id === list2Item.id)
|
||||||
if (confictingItem &&
|
if (conflictingItem &&
|
||||||
list2Item.updatedAt && confictingItem.updatedAt &&
|
list2Item.updatedAt && conflictingItem.updatedAt &&
|
||||||
list2Item.updatedAt > confictingItem.updatedAt) {
|
list2Item.updatedAt > conflictingItem.updatedAt) {
|
||||||
mergedList.splice(mergedList.indexOf(confictingItem), 1, list2Item)
|
mergedList.splice(mergedList.indexOf(conflictingItem), 1, list2Item)
|
||||||
} else if (!confictingItem) {
|
} else if (!conflictingItem) {
|
||||||
mergedList.push(list2Item)
|
mergedList.push(list2Item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue