From b94f67aa72290b1cd7b14a32238ff23e53d2d0c1 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 10 Aug 2025 21:53:21 +0300 Subject: [PATCH] fix(react/dialogs): entering command palette --- apps/client/src/widgets/dialogs/jump_to_note.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/dialogs/jump_to_note.tsx b/apps/client/src/widgets/dialogs/jump_to_note.tsx index e7673b32e..53a8fa35a 100644 --- a/apps/client/src/widgets/dialogs/jump_to_note.tsx +++ b/apps/client/src/widgets/dialogs/jump_to_note.tsx @@ -15,7 +15,7 @@ const KEEP_LAST_SEARCH_FOR_X_SECONDS = 120; type Mode = "last-search" | "recent-notes" | "commands"; function JumpToNoteDialogComponent() { - const [ mode, setMode ] = useState("last-search"); + const [ mode, setMode ] = useState(); const [ lastOpenedTs, setLastOpenedTs ] = useState(0); const containerRef = useRef(null); const autocompleteRef = useRef(null); @@ -23,11 +23,13 @@ function JumpToNoteDialogComponent() { const [ initialText, setInitialText ] = useState(isCommandMode ? "> " : ""); const actualText = useRef(initialText); const [ shown, setShown ] = useState(false); - + async function openDialog(commandMode: boolean) { let newMode: Mode; + let initialText: string = ""; if (commandMode) { - newMode = "commands"; + newMode = "commands"; + initialText = ">"; } else if (Date.now() - lastOpenedTs > KEEP_LAST_SEARCH_FOR_X_SECONDS * 1000) { // 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) @@ -42,6 +44,7 @@ function JumpToNoteDialogComponent() { setMode(newMode); } + setInitialText(initialText); setShown(true); setLastOpenedTs(Date.now()); }