Skip to content

Commit

Permalink
Merge pull request #84 from georgejkaye/fix-vanishing-things
Browse files Browse the repository at this point in the history
[fix] Fix replace items function
  • Loading branch information
georgejkaye authored Jan 30, 2024
2 parents b9b3c62 + 3fd7de7 commit f8de21d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions client/src/app/structs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ export const replaceItems = <T>(
eqCheck: (t1: T, t2: T) => boolean
) =>
oldItems
.map(
.filter(
(oldItem) =>
itemsToAdd.find((newItem) => eqCheck(oldItem, newItem)) ||
oldItem
)
.filter((item) =>
itemsToRemove.find((removedItem) => eqCheck(item, removedItem))
!itemsToAdd.find((newItem) => eqCheck(oldItem, newItem)) &&
!itemsToRemove.find((remItem) => eqCheck(oldItem, remItem))
)
.concat(itemsToAdd)

export const getDateString = (datetime: Date) => {
let weekday = datetime.toLocaleDateString("en-GB", {
Expand Down

0 comments on commit f8de21d

Please sign in to comment.