[Bug] Issue opening dicom files with dicomJson in production(on netlify/amplify)
chuboyo opened this issue · comments
Describe the Bug
When opening dicom files using dicomJson in production(on netlify/amplify), the following error is raised in some instances:
ViewportGridProvider.tsx:377 TypeError: Cannot read properties of undefined (reading 'length')
ErrorBoundary.tsx:84 Route /viewer/dicomjson Error Boundary TypeError: Cannot read properties of undefined (reading 'length')
The dicomJson files always work on the official ohif viewer site( e.g. https://viewer.ohif.org/viewer/dicomjson/?url=https://ohiftest1.s3.eu-central-1.amazonaws.com/test.json) but not on netlify/amplify deployments.
Steps to Reproduce
To reproduce:
- visit - https://main.dgsy7key1abhd.amplifyapp.com/viewer/dicomjson/?url=https://ohiftest1.s3.eu-central-1.amazonaws.com/test3.json, verify that the dicom files are loaded from the url provided.
- visit - https://main.dgsy7key1abhd.amplifyapp.com/viewer/dicomjson/?url=https://ohiftest1.s3.eu-central-1.amazonaws.com/test.json, verify that the dicom files are not loaded from the url provided.
- Experiment with the official dicomJson provided in the docs - https://main.dgsy7key1abhd.amplifyapp.com/viewer/dicomjson/?url= https://ohif-dicom-json-example.s3.amazonaws.com/LIDC-IDRI-0001.json, verify that it is not loading the files as well.
- Alternatively, you could deploy a new instance of the viewer on netlify or aws amplify and experiment with the dicom files.
The current behavior
A pop-up indicating that an error occurred is displayed.
The expected behavior
The viewer with the dicom files should be displayed.
OS
Mac OS Sonoma 14.3.1
Node version
18
Browser
Chrome Version 123.0.6312.87
The error was because of an issue with the patient name formatting in the header component.
Here is a hotfix, replace line 51 in platform/ui/src/components/HeaderPatientInfo/HeaderPatientInfo.tsx which should currently be
PatientName: instance.PatientName ? formatPN(instance.PatientName.Alphabetical) : '',
with
PatientName: instance.PatientName ? formatPN(instance.PatientName) : '',
That should fix this particular issue.
It seems the current issue has also been fixed in 3.8.0-beta.
great!