mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
more robust search in face of inconsistent cache
This commit is contained in:
parent
a108ef91a0
commit
b12008e313
@ -17,10 +17,14 @@ const utils = require('../../utils.js');
|
|||||||
*/
|
*/
|
||||||
function findNotesWithExpression(expression) {
|
function findNotesWithExpression(expression) {
|
||||||
const hoistedNote = noteCache.notes[hoistedNoteService.getHoistedNoteId()];
|
const hoistedNote = noteCache.notes[hoistedNoteService.getHoistedNoteId()];
|
||||||
const allNotes = (hoistedNote && hoistedNote.noteId !== 'root')
|
let allNotes = (hoistedNote && hoistedNote.noteId !== 'root')
|
||||||
? hoistedNote.subtreeNotes
|
? hoistedNote.subtreeNotes
|
||||||
: Object.values(noteCache.notes);
|
: Object.values(noteCache.notes);
|
||||||
|
|
||||||
|
// in the process of loading data sometimes we create "skeleton" note instances which are expected to be filled later
|
||||||
|
// in case of inconsistent data this might not work and search will then crash on these
|
||||||
|
allNotes = allNotes.filter(note => note.type !== undefined);
|
||||||
|
|
||||||
const allNoteSet = new NoteSet(allNotes);
|
const allNoteSet = new NoteSet(allNotes);
|
||||||
|
|
||||||
const searchContext = {
|
const searchContext = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user