Skip to content

Build your personal knowledge base with Trilium Notes

fix(react/dialogs): note autocomplete not restoring note

Elian Doranb5555d94f5fc
diff --git a/apps/client/src/widgets/react/NoteAutocomplete.tsx b/apps/client/src/widgets/react/NoteAutocomplete.tsx
index fb5274318e..2fd250c765 100644
--- a/apps/client/src/widgets/react/NoteAutocomplete.tsx
+++ b/apps/client/src/widgets/react/NoteAutocomplete.tsx
@@ -60,13 +60,16 @@ export default function NoteAutocomplete({ inputRef: _ref, text, placeholder, on
useEffect(() => {
if (!ref.current) return;
- if (text) {
- const $autoComplete = $(ref.current);
+ const $autoComplete = $(ref.current);
+
+ if (noteId) {
+ $autoComplete.setNote(noteId);
+ } else if (text) {
note_autocomplete.setText($autoComplete, text);
} else {
ref.current.value = "";
}
- }, [text]);
+ }, [text, noteId]);
return (
<div className="input-group" style={containerStyle}>