fix(sr): rendering issue by running loadSR before updateSR (#4226)

This commit is contained in:
Joeycho 2024-06-12 20:57:38 +02:00 committed by GitHub
parent a97666ea4e
commit 6971287460
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -270,17 +270,23 @@ function OHIFCornerstoneSRViewport(props: withAppTypes) {
updateViewport(measurementSelected); updateViewport(measurementSelected);
}; };
loadSR(); loadSR();
}, [dataSource, srDisplaySet]); }, [srDisplaySet]);
/** /**
* Hook to update the tracking identifiers when the selected measurement changes or * Hook to update the tracking identifiers when the selected measurement changes or
* the element changes * the element changes
*/ */
useEffect(() => { useEffect(() => {
const updateSR = async () => {
if (!srDisplaySet.isLoaded) {
await srDisplaySet.load();
}
if (!element || !srDisplaySet.isLoaded) { if (!element || !srDisplaySet.isLoaded) {
return; return;
} }
setTrackingIdentifiers(measurementSelected); setTrackingIdentifiers(measurementSelected);
}
updateSR();
}, [measurementSelected, element, setTrackingIdentifiers, srDisplaySet]); }, [measurementSelected, element, setTrackingIdentifiers, srDisplaySet]);
/** /**