Open vnosikov opened 9 months ago
I ran into the exact same issue and had no idea separate renderingEngineCache
instances were being created per resolved version of @cornerstone/core
. Thanks so much for this workaround!
I ran into the exact same issue and had no idea separate
renderingEngineCache
instances were being created per resolved version of@cornerstone/core
. Thanks so much for this workaround!
You are welcome. Debugging this was truly a mind-blowing experience; I am glad it is useful to other people too
@sedghi why did you close this issue? Yes, I provided a workable workaround, but the underlying issue stands and I guess you should either change your inter-package dependencies to fixed versions (I checked the last version they are still caret) or at least explicitly describe this pitfall in a documentation. Is there any reason no to do so?
@sedghi This is still an issue, please re-open
I think this is fixed in Cornerstone3D 2.0 since others have core as peerDependency, please check
Here are the migration guides:
Try OHIF locally: https://viewer-dev.ohif.org/localbasic
Try Cornerstone3D 2.0 locally: https://www.cornerstonejs.org/live-examples/local.html
Describe the Bug
A user may decide to use a fixed cornerstone version. Imagine she configures her package.json like this:
However packages of
@cornerstonejs/tools
,@cornerstonejs/streaming-image-volume-loader
and@cornerstonejs/dicom-image-loader
are also dependent on@cornerstonjs/core
. And their package.json use caret versions.For example, https://github.com/cornerstonejs/cornerstone3D/blob/v1.44.3/packages/tools/package.json:
So what happens when a user install dependencies? Turns out it depends on her package manager.
npm
dedupes newer versions and the user gets 1.44.3 as she expected. Howeveryarn
will install both 1.44.3 and the latest caret versions (Right now it is 1.47.4, so going forward I will use this tag).So now when a user calls cornerstone, she uses 1.44.3 version. However when cornerstone-tools calls anything from cornerstone they reach to 1.47.4 version. Usually it breaks the app very fast, as for example tools can not address a rendering engine. It was dutifully stored in a
renderingEngineCache
, but it was arenderingEngineCache
of a version 1.44.3 andrenderingEngineCache
of a version 1.47.4 is empty, so please take this white screen of death and good luck with debugging it.You can work-around this either by using only
npm
, or by configuring overrides/resolutions inpackage.json
. However this problem can be extremely painful for an unprepared user. I kindly ask you to use only fixed versions of cornerstone-related dependencies in your packages. If for some reason you don't want to do it, please add some information in documentation about this pitfall.Steps to Reproduce
yarn install
yarn list @cornerstonejs/core
├── @cornerstonejs/core@1.44.3 ├─┬ @cornerstonejs/dicom-image-loader@1.44.3 │ └── @cornerstonejs/core@1.44.3 deduped ├─┬ @cornerstonejs/streaming-image-volume-loader@1.44.3 │ └── @cornerstonejs/core@1.44.3 deduped └─┬ @cornerstonejs/tools@1.44.3 └── @cornerstonejs/core@1.44.3 deduped