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

This commit is contained in:
Joeycho authored and GitHub committed 2024-06-12 14:57:38 -04:00
1 parent a97666ea4e
commit 6971287460
1 file changed
+7 -1
@@ -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]);
/** /**