Skip to content

Build your personal knowledge base with Trilium Notes

fix multivalue issue of not appearing when no attribute has been saved yet

azivnerb0ed790edfc8
diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js
index 3d4852bfb0..a0425e9646 100644
--- a/src/public/javascripts/services/note_detail.js
+++ b/src/public/javascripts/services/note_detail.js
@@ -262,25 +262,26 @@ async function loadAttributes() {
if (definition.labelType === 'text') {
$input.prop("type", "text");
- const attributeValues = await server.get('attributes/values/' + encodeURIComponent(valueAttr.name));
-
- if (attributeValues.length === 0) {
- return;
- }
-
- $input.autocomplete({
- // shouldn't be required and autocomplete should just accept array of strings, but that fails
- // because we have overriden filter() function in autocomplete.js
- source: attributeValues.map(attribute => {
- return {
- attribute: attribute,
- value: attribute
- }
- }),
- minLength: 0
+ // no need to await for this, can be done asynchronously
+ server.get('attributes/values/' + encodeURIComponent(valueAttr.name)).then(attributeValues => {
+ if (attributeValues.length === 0) {
+ return;
+ }
+
+ $input.autocomplete({
+ // shouldn't be required and autocomplete should just accept array of strings, but that fails
+ // because we have overriden filter() function in autocomplete.js
+ source: attributeValues.map(attribute => {
+ return {
+ attribute: attribute,
+ value: attribute
+ }
+ }),
+ minLength: 0
+ });
+
+ $input.focus(() => $input.autocomplete("search", ""));
});
-
- $input.focus(() => $input.autocomplete("search", ""));
}
else if (definition.labelType === 'number') {
$input.prop("type", "number");
@@ -352,6 +353,7 @@ async function loadAttributes() {
$multiplicityCell.append(addButton).append("   ").append(removeButton);
}
+
return $tr;
}