Skip to content

Commit 54d3936

Browse files
committed
feat(board/promoted_attributes): support multiple values
1 parent 02452a0 commit 54d3936

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,24 @@ function getAttributesWithDefinitions(note: FNote, attributesToIgnore: string[]
9696
for (const attr of promotedDefinitionAttributes) {
9797
const def = attr.getDefinition();
9898
const [ type, name ] = attr.name.split(":", 2);
99-
const value = type === "label" ? note.getLabelValue(name) : note.getRelationValue(name);
10099
const friendlyName = def?.promotedAlias || name;
101-
if (!value) continue;
102-
if (attributesToIgnore.includes(name)) continue;
100+
const props: Omit<AttributeWithDefinitions, "value"> = { def, name, type, friendlyName };
101+
102+
if (type === "label") {
103+
const labels = note.getLabels(name);
104+
for (const label of labels) {
105+
if (!label.value) continue;
106+
result.push({ ...props, value: label.value } );
107+
}
108+
} else if (type === "relation") {
109+
const relations = note.getRelations(name);
110+
for (const relation of relations) {
111+
if (!relation.value) continue;
112+
result.push({ ...props, value: relation.value } );
113+
}
114+
}
103115

104-
result.push({ def, name, type, value, friendlyName });
116+
if (attributesToIgnore.includes(name)) continue;
105117
}
106118
return result;
107119
}

0 commit comments

Comments
 (0)