From 82dce7a0d351e63ee654ce58bad5229c163c445a Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 10 Aug 2025 22:41:20 +0300 Subject: [PATCH] fix(react/dialogs): restore jump to note text --- apps/client/src/widgets/dialogs/jump_to_note.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/client/src/widgets/dialogs/jump_to_note.tsx b/apps/client/src/widgets/dialogs/jump_to_note.tsx index 53a8fa35a..3af1b1aba 100644 --- a/apps/client/src/widgets/dialogs/jump_to_note.tsx +++ b/apps/client/src/widgets/dialogs/jump_to_note.tsx @@ -27,17 +27,19 @@ function JumpToNoteDialogComponent() { async function openDialog(commandMode: boolean) { let newMode: Mode; let initialText: string = ""; + if (commandMode) { newMode = "commands"; initialText = ">"; - } else if (Date.now() - lastOpenedTs > KEEP_LAST_SEARCH_FOR_X_SECONDS * 1000) { + } else if (Date.now() - lastOpenedTs <= KEEP_LAST_SEARCH_FOR_X_SECONDS * 1000 && actualText) { // if you open the Jump To dialog soon after using it previously, it can often mean that you // actually want to search for the same thing (e.g., you opened the wrong note at first try) // so we'll keep the content. // if it's outside of this time limit, then we assume it's a completely new search and show recent notes instead. - newMode = "recent-notes"; - } else { newMode = "last-search"; + initialText = actualText.current; + } else { + newMode = "recent-notes"; } if (mode !== newMode) { @@ -69,10 +71,7 @@ function JumpToNoteDialogComponent() { const $autoComplete = refToJQuerySelector(autocompleteRef); switch (mode) { case "last-search": - // Fall-through if there is no text, in order to display the recent notes. - if (initialText) { - break; - } + break; case "recent-notes": note_autocomplete.showRecentNotes($autoComplete); break;