mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(react/dialogs): autocomplete not displayed if list is empty
This commit is contained in:
parent
d5e42318dd
commit
cb650b70cb
@ -23,10 +23,6 @@ function JumpToNoteDialogComponent({ mode }: JumpToNoteDialogProps) {
|
|||||||
const [ isCommandMode, setIsCommandMode ] = useState(mode === "commands");
|
const [ isCommandMode, setIsCommandMode ] = useState(mode === "commands");
|
||||||
const [ text, setText ] = useState(isCommandMode ? "> " : "");
|
const [ text, setText ] = useState(isCommandMode ? "> " : "");
|
||||||
|
|
||||||
console.log(`Got text '${text}'`);
|
|
||||||
|
|
||||||
console.log("Rendering with mode:", mode, "isCommandMode:", isCommandMode);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsCommandMode(text.startsWith(">"));
|
setIsCommandMode(text.startsWith(">"));
|
||||||
}, [ text ]);
|
}, [ text ]);
|
||||||
@ -44,7 +40,10 @@ function JumpToNoteDialogComponent({ mode }: JumpToNoteDialogProps) {
|
|||||||
const $autoComplete = $(autocompleteRef.current);
|
const $autoComplete = $(autocompleteRef.current);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case "last-search":
|
case "last-search":
|
||||||
break;
|
// Fall-through if there is no text, in order to display the recent notes.
|
||||||
|
if (text) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "recent-notes":
|
case "recent-notes":
|
||||||
note_autocomplete.showRecentNotes($autoComplete);
|
note_autocomplete.showRecentNotes($autoComplete);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user