To prevent search lag when there are a large number of notes

This commit is contained in:
SiriusXT
2025-04-01 21:07:15 +08:00
parent a7799d32b0
commit adcb803caa
4 changed files with 15 additions and 13 deletions

View File

@@ -11,7 +11,8 @@ const SELECTED_NOTE_PATH_KEY = "data-note-path";
const SELECTED_EXTERNAL_LINK_KEY = "data-external-link";
// To prevent search lag when there are a large number of notes, set a delay based on the number of notes to avoid jitter.
const notesCount = await server.get<number>(`stats/notesCount`);
const notesCount = await server.get<number>(`autocomplete/notesCount`);
console.log(notesCount);
let debounceTimeoutId: ReturnType<typeof setTimeout>;
function getSearchDelay(notesCount: number): number {