fix: close ontology popup when navigating to different LinkML schema files
All checks were successful
Deploy Frontend / build-and-deploy (push) Successful in 4m17s

When users click on a different class, enum, or slot in the sidebar,
the ontology term popup now automatically closes. This prevents the
popup from persisting and showing stale information from the
previously viewed schema element.
This commit is contained in:
kempersc 2026-01-13 18:22:49 +01:00
parent 635beca582
commit fc63164335

View file

@ -1691,6 +1691,8 @@ const LinkMLViewerPage: React.FC = () => {
const navigateToClass = useCallback((className: string) => { const navigateToClass = useCallback((className: string) => {
setSearchParams({ class: className }); setSearchParams({ class: className });
setHighlightedClass(className); setHighlightedClass(className);
// Close any open ontology popup when navigating
setOntologyPopupCurie(null);
// Find and select the class file // Find and select the class file
const classFile = categories const classFile = categories
@ -1708,6 +1710,8 @@ const LinkMLViewerPage: React.FC = () => {
const navigateToEnum = useCallback((enumName: string) => { const navigateToEnum = useCallback((enumName: string) => {
setSearchParams({ enum: enumName }); setSearchParams({ enum: enumName });
setHighlightedClass(enumName); // Reuse highlight state for enums setHighlightedClass(enumName); // Reuse highlight state for enums
// Close any open ontology popup when navigating
setOntologyPopupCurie(null);
// Find and select the enum file // Find and select the enum file
const enumFile = categories const enumFile = categories
@ -1725,6 +1729,8 @@ const LinkMLViewerPage: React.FC = () => {
const navigateToSlot = useCallback((slotName: string) => { const navigateToSlot = useCallback((slotName: string) => {
setSearchParams({ slot: slotName }); setSearchParams({ slot: slotName });
setHighlightedClass(slotName); // Reuse highlight state for slots setHighlightedClass(slotName); // Reuse highlight state for slots
// Close any open ontology popup when navigating
setOntologyPopupCurie(null);
// Find and select the slot file // Find and select the slot file
const slotFile = categories const slotFile = categories
@ -3654,8 +3660,9 @@ const LinkMLViewerPage: React.FC = () => {
} else if (category.name === 'slot') { } else if (category.name === 'slot') {
navigateToSlot(file.name); navigateToSlot(file.name);
} else { } else {
// For main schemas, clear the deep link params // For main schemas, clear the deep link params and close any popup
setSearchParams({}); setSearchParams({});
setOntologyPopupCurie(null);
} }
}} }}
> >