Skip to content

Commit

Permalink
[Enhancement #528] Load related vocabularies when vocabulary IRI chan…
Browse files Browse the repository at this point in the history
…ges.
  • Loading branch information
ledsoft committed Oct 9, 2024
1 parent 734079a commit b3b4561
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/component/vocabulary/modeling/OpenModelingToolDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ const OpenModelingToolDialog: React.FC<OpenModelingToolDialogProps> = ({
const vocabularies = useSelector((state: TermItState) => state.vocabularies);
const vocabularyIris = Object.keys(vocabularies);
React.useEffect(() => {
if (open) {
dispatch(
loadRelatedVocabularies(VocabularyUtils.create(vocabulary.iri))
).then((data) => {
setRelatedVocabularies(data);
// The vocabulary is also among the related vocabularies loaded from the server
setSelectedVocabularies(data);
});
if (Object.keys(vocabularies).length === 0) {
dispatch(loadVocabularies());
}
dispatch(
loadRelatedVocabularies(VocabularyUtils.create(vocabulary.iri))
).then((data) => {
setRelatedVocabularies(data);
// The vocabulary is also among the related vocabularies loaded from the server
setSelectedVocabularies(data);
});
if (Object.keys(vocabularies).length === 0) {
dispatch(loadVocabularies());
}
}, [open, vocabulary.iri, vocabularies, dispatch]);
}, [vocabulary.iri, vocabularies, dispatch]);

const onSelect = (vIri: string) => {
if (selectedVocabularies.includes(vIri)) {
Expand Down

0 comments on commit b3b4561

Please sign in to comment.