1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-16 19:21:52 +00:00

Include each note only once when sorting by pin

Fixes #983
This commit is contained in:
Nathaniel Watson
2017-10-30 21:51:44 +13:00
parent 3f49a8a15a
commit e60f4f4a64

View File

@@ -285,11 +285,18 @@ class NoteList extends React.Component {
} }
sortByPin (unorderedNotes) { sortByPin (unorderedNotes) {
const pinnedNotes = unorderedNotes.filter((note) => { const pinnedNotes = []
return note.isPinned const unpinnedNotes = []
unorderedNotes.forEach((note) => {
if (note.isPinned) {
pinnedNotes.push(note)
} else {
unpinnedNotes.push(note)
}
}) })
return pinnedNotes.concat(unorderedNotes) return pinnedNotes.concat(unpinnedNotes)
} }
handleNoteClick (e, uniqueKey) { handleNoteClick (e, uniqueKey) {