Skip to content

Commit

Permalink
PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeOberti committed Jul 19, 2024
1 parent f5debe8 commit 7c40a31
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,13 @@ export const selectSortedNotesByDocumentId = createSelector(
const { field, direction } = sort;
return notes
.filter((note: Note) => note.eventId === documentId)
.sort((a: Note, b: Note) =>
// @ts-ignore Object is possibly null or undefined
direction === 'asc' ? (a[field] > b[field] ? 1 : -1) : a[field] > b[field] ? -1 : 1
);
.sort((first: Note, second: Note) => {
const a = first[field];
const b = second[field];
if (a == null) return 1;
if (b == null) return -1;
return direction === 'asc' ? (a > b ? 1 : -1) : a > b ? -1 : 1;
});
}
);

Expand Down

0 comments on commit 7c40a31

Please sign in to comment.