1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

change filter function to find, find will match the first note with requested key

This commit is contained in:
David Dreher
2019-03-22 21:56:49 +01:00
committed by Junyoung Choi
parent 70e57cf738
commit 91d04b99d1

View File

@@ -269,10 +269,9 @@ class NoteList extends React.Component {
const selectedNoteKeys = [noteHash] const selectedNoteKeys = [noteHash]
let locationToSelect = '/home' let locationToSelect = '/home'
const notesByHash = data.noteMap.map((note) => note).filter((note) => note.key === noteHash) const noteByHash = data.noteMap.map((note) => note).find(note => { return note.key === noteHash })
if (notesByHash.length > 0) { if (noteByHash !== undefined) {
const note = notesByHash[0] locationToSelect = '/storages/' + noteByHash.storage + '/folders/' + noteByHash.folder
locationToSelect = '/storages/' + note.storage + '/folders/' + note.folder
} }
this.focusNote(selectedNoteKeys, noteHash, locationToSelect) this.focusNote(selectedNoteKeys, noteHash, locationToSelect)