Skip to content

Commit 34d3cc6

Browse files
author
djinni-hppro
committed
minisearch
1 parent 74c9890 commit 34d3cc6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,6 @@ document.addEventListener('alpine:init', () => { Alpine.data('mainApp', () => ({
705705
const notesFromDB = await getNotesDB();
706706
this.notes = notesFromDB.sort((a, b) => (b.priority || 0) - (a.priority || 0) || new Date(b.updatedAt) - new Date(a.updatedAt));
707707
this.updateAppBadge();
708-
this.miniSearch?.removeAll();
709708

710709
const uniqueNotes = Array.from(new Map(this.notes.map(note => [note.id, note])).values());
711710
if (uniqueNotes.length < this.notes.length) {
@@ -715,7 +714,8 @@ document.addEventListener('alpine:init', () => { Alpine.data('mainApp', () => ({
715714

716715
// Defer indexing to avoid blocking the main thread
717716
setTimeout(() => {
718-
this.miniSearch?.addAll(this.notes);
717+
this.miniSearch?.removeAll();
718+
this.miniSearch?.addAll(this.notes.filter(x => !this.miniSearch?.has?.(x.id)));
719719
}, 100);
720720

721721
this.updateNotesCache();

0 commit comments

Comments
 (0)