fix: Hanging protocol state fixes (#3242)
* fix: Some residual issues with hanging protocol after state sync fix: Some issues introduced by the state syncing changes * fix: PR fixes, mostly code cleanup * Improve a race condition in an automated test * Remove obsolete code * PR fixes
This commit is contained in:
1 parent
544bf55a4f
commit
ee4e8a4105
19 files changed
+268
-171
No files matched your search
@@ -220,15 +220,27 @@ const OHIFCornerstoneViewport = React.memo(props => {
|
||||
const currentPresentation = cornerstoneViewportService.getPresentation(
|
||||
viewportIndex
|
||||
);
|
||||
const { presentationSync } = stateSyncService.getState();
|
||||
if (currentPresentation) {
|
||||
stateSyncService.store({
|
||||
presentationSync: {
|
||||
...presentationSync,
|
||||
[currentPresentation.id]: currentPresentation,
|
||||
},
|
||||
});
|
||||
if (!currentPresentation || !currentPresentation.presentationIds) return;
|
||||
const {
|
||||
lutPresentationStore,
|
||||
positionPresentationStore,
|
||||
} = stateSyncService.getState();
|
||||
const { presentationIds } = currentPresentation;
|
||||
const { lutPresentationId, positionPresentationId } = presentationIds || {};
|
||||
const storeState = {};
|
||||
if (lutPresentationId) {
|
||||
storeState.lutPresentationStore = {
|
||||
...lutPresentationStore,
|
||||
[lutPresentationId]: currentPresentation,
|
||||
};
|
||||
}
|
||||
if (positionPresentationId) {
|
||||
storeState.positionPresentationStore = {
|
||||
...positionPresentationStore,
|
||||
[positionPresentationId]: currentPresentation,
|
||||
};
|
||||
}
|
||||
stateSyncService.store(storeState);
|
||||
};
|
||||
|
||||
const cleanUpServices = useCallback(() => {
|
||||
@@ -384,18 +396,25 @@ const OHIFCornerstoneViewport = React.memo(props => {
|
||||
|
||||
storePresentation();
|
||||
|
||||
const { presentationSync } = stateSyncService.getState();
|
||||
const { presentationId } = viewportOptions;
|
||||
const presentation = presentationId
|
||||
? (presentationSync[presentationId] as Presentation)
|
||||
: null;
|
||||
const {
|
||||
lutPresentationStore,
|
||||
positionPresentationStore,
|
||||
} = stateSyncService.getState();
|
||||
const { presentationIds } = viewportOptions;
|
||||
const presentations = {
|
||||
positionPresentation:
|
||||
positionPresentationStore[presentationIds?.positionPresentationId],
|
||||
lutPresentation:
|
||||
lutPresentationStore[presentationIds?.lutPresentationId],
|
||||
};
|
||||
console.log('Using presentations', presentations);
|
||||
|
||||
cornerstoneViewportService.setViewportData(
|
||||
viewportIndex,
|
||||
viewportData,
|
||||
viewportOptions,
|
||||
displaySetOptions,
|
||||
presentation
|
||||
presentations
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user