Skip to content

Commit b47684f

Browse files
Pollepsjoepio
authored andcommitted
#827 Fix allows-only always set in ontology editor
1 parent 7907d71 commit b47684f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

browser/data-browser/src/views/OntologyPage/Property/EnumFormPart.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ const TagPanel: FC<TagPanelProps> = ({ resource, ontology }) => {
7373
// We filter out anything that is not a tag.
7474
filterAllowsOnly(resource, dataBrowser.classes.tag, store).then(
7575
filteredTags => {
76-
setTags(filteredTags);
76+
setTags(filteredTags ?? []);
7777

78-
if (filteredTags.length === allowsOnly.length) {
78+
if (
79+
filteredTags === undefined ||
80+
filteredTags.length === allowsOnly.length
81+
) {
7982
return;
8083
}
8184

browser/data-browser/src/views/OntologyPage/Property/filterAllowsOnly.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ export async function filterAllowsOnly(
44
resource: Resource<Core.Property>,
55
isA: string,
66
store: Store,
7-
): Promise<string[]> {
8-
const allowsOnly = resource.props.allowsOnly ?? [];
7+
): Promise<string[] | undefined> {
8+
const allowsOnly = resource.props.allowsOnly;
9+
10+
if (allowsOnly === undefined) {
11+
return;
12+
}
13+
914
const filteredTags: string[] = [];
1015

1116
for (const line of allowsOnly) {

0 commit comments

Comments
 (0)