mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Fixing empty string searching
This commit is contained in:
@@ -40,7 +40,7 @@ class Detail extends React.Component {
|
|||||||
let note = null
|
let note = null
|
||||||
if (location.query.key != null) {
|
if (location.query.key != null) {
|
||||||
const noteKey = location.query.key
|
const noteKey = location.query.key
|
||||||
let displayedNotes, noteKeys
|
let displayedNotes = []
|
||||||
|
|
||||||
if (location.pathname.match(/\/home/) || location.pathname.match(/alltags/)) {
|
if (location.pathname.match(/\/home/) || location.pathname.match(/alltags/)) {
|
||||||
displayedNotes = data.noteMap.map(note => note)
|
displayedNotes = data.noteMap.map(note => note)
|
||||||
@@ -49,10 +49,10 @@ class Detail extends React.Component {
|
|||||||
displayedNotes = data.starredSet.toJS().map(uniqueKey => data.noteMap.get(uniqueKey))
|
displayedNotes = data.starredSet.toJS().map(uniqueKey => data.noteMap.get(uniqueKey))
|
||||||
}
|
}
|
||||||
if (location.pathname.match(/\/searched/)) {
|
if (location.pathname.match(/\/searched/)) {
|
||||||
displayedNotes = searchFromNotes(
|
const searchStr = params.searchword
|
||||||
data.noteMap.map(note => note),
|
const allNotes = data.noteMap.map(note => note)
|
||||||
params.searchword
|
displayedNotes = searchStr === undefined || searchStr === '' ? allNotes
|
||||||
)
|
: searchFromNotes(allNotes, searchStr)
|
||||||
}
|
}
|
||||||
if (location.pathname.match(/\/trashed/)) {
|
if (location.pathname.match(/\/trashed/)) {
|
||||||
displayedNotes = data.trashedSet.toJS().map(uniqueKey => data.noteMap.get(uniqueKey))
|
displayedNotes = data.trashedSet.toJS().map(uniqueKey => data.noteMap.get(uniqueKey))
|
||||||
@@ -64,7 +64,7 @@ class Detail extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
noteKeys = displayedNotes.map(note => note.key)
|
const noteKeys = displayedNotes.map(note => note.key)
|
||||||
if (noteKeys.includes(noteKey)) {
|
if (noteKeys.includes(noteKey)) {
|
||||||
note = data.noteMap.get(noteKey)
|
note = data.noteMap.get(noteKey)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user