Skip to content

Commit

Permalink
#827 Fix allows-only always set in ontology editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Polleps authored and joepio committed Jan 30, 2024
1 parent 7907d71 commit b47684f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ const TagPanel: FC<TagPanelProps> = ({ resource, ontology }) => {
// We filter out anything that is not a tag.
filterAllowsOnly(resource, dataBrowser.classes.tag, store).then(
filteredTags => {
setTags(filteredTags);
setTags(filteredTags ?? []);

if (filteredTags.length === allowsOnly.length) {
if (
filteredTags === undefined ||
filteredTags.length === allowsOnly.length
) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ export async function filterAllowsOnly(
resource: Resource<Core.Property>,
isA: string,
store: Store,
): Promise<string[]> {
const allowsOnly = resource.props.allowsOnly ?? [];
): Promise<string[] | undefined> {
const allowsOnly = resource.props.allowsOnly;

if (allowsOnly === undefined) {
return;
}

const filteredTags: string[] = [];

for (const line of allowsOnly) {
Expand Down

0 comments on commit b47684f

Please sign in to comment.