Skip to content

Build your personal knowledge base with Trilium Notes

fix(promoted_attributes): auto-complete interfering with value

Elian Dorand924d3fa4fed
diff --git a/apps/client/src/widgets/PromotedAttributes.tsx b/apps/client/src/widgets/PromotedAttributes.tsx
index 779fe6a300..f40307a900 100644
--- a/apps/client/src/widgets/PromotedAttributes.tsx
+++ b/apps/client/src/widgets/PromotedAttributes.tsx
@@ -37,7 +37,7 @@ interface CellProps {
}
type OnChangeEventData = TargetedEvent<HTMLInputElement, Event> | InputEvent | JQuery.TriggeredEvent<HTMLInputElement, undefined, HTMLInputElement, HTMLInputElement>;
-type OnChangeListener = (e: OnChangeEventData) => Promise<void>;
+type OnChangeListener = (e: OnChangeEventData) => void | Promise<void>;
export default function PromotedAttributes() {
const { note, componentId, noteContext } = useNoteContext();
@@ -200,7 +200,11 @@ function LabelInput(props: CellProps & { inputId: string }) {
}, [ cell, componentId, note, setCells ]);
const extraInputProps: InputHTMLAttributes = {};
- useTextLabelAutocomplete(inputId, valueAttr, definition, onChangeListener);
+ useTextLabelAutocomplete(inputId, valueAttr, definition, (e) => {
+ if (e.currentTarget instanceof HTMLInputElement) {
+ setDraft(e.currentTarget.value);
+ }
+ });
// React to model changes.
useEffect(() => {