Skip to content

Commit

Permalink
fix(cataloging-bulkchanges): don't try to access @id for undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
lrosenstrom committed Oct 28, 2024
1 parent 5be1c20 commit 58fbdce
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions cataloging/src/components/mixins/sidesearch-mixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,25 @@ export default {
const fieldParentPath = this.path.split('.').slice(0, -2).join('.');
const fieldParentType = get(this.inspector.data, fieldParentPath)['@type']; // e.g. Text
const fieldParentBaseClasses = VocabUtil.getBaseClasses(
VocabUtil.getTermObject(fieldParentType, this.resources.vocab, this.resources.context)['@id'],
this.resources.vocab,
this.resources.context,
);
const parentObj = VocabUtil.getTermObject(fieldParentType, this.resources.vocab, this.resources.context);
if (parentObj) {
const fieldParentBaseClasses = VocabUtil.getBaseClasses(
parentObj['@id'],
this.resources.vocab,
this.resources.context,
);
const linkableDomainIds = fieldParentBaseClasses
.filter((baseClassName) => subClassesOfRanges.includes(baseClassName))
.map(((className) => VocabUtil.getTermObject(className, this.resources.vocab, this.resources.context)['@id']));
const linkableDomainIds = fieldParentBaseClasses
.filter((baseClassName) => subClassesOfRanges.includes(baseClassName))
.map(((className) => VocabUtil.getTermObject(className, this.resources.vocab, this.resources.context)['@id']));
// Append urlSearchParams with linkable domain ids
linkableDomainIds.forEach((className) => urlSearchParams.append('or-domain.@id', className));
// Append urlSearchParams with linkable domain ids
linkableDomainIds.forEach((className) => urlSearchParams.append('or-domain.@id', className));
}
}
}
const searchUrl = `${this.settings.apiPath}/find.jsonld?${urlSearchParams.toString()}`;
return new Promise((resolve, reject) => {
// Check if abortcontroller is available
// ie11 doesn't have it atm so they don't get cancellable fetches...
Expand Down

0 comments on commit 58fbdce

Please sign in to comment.