Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cornerstone.imageCache.purgeCache() caused error

See original GitHub issue

Hello cornerstone.imageCache.purgeCache() caused this error.

Uncaught TypeError: imagePromise.reject is not a function
    at Object.<anonymous> (cornerstone.js:699)
    at Object.<anonymous> (jquery.min.js:2)
    at i (jquery.min.js:2)
    at Object.add [as done] (jquery.min.js:2)
    at Array.<anonymous> (jquery.min.js:2)
    at Function.each (jquery.min.js:2)
    at Object.<anonymous> (jquery.min.js:2)
    at Function.Deferred (jquery.min.js:2)
    at Object.then (jquery.min.js:2)
    at decache (cornerstone.js:695)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

diego0020commented, Jun 27, 2017

I have been thinking about this. Taking a step back, the image loader issues a promise, and then the cache waits for the promise to be fulfilled (or fail). Rejecting the promise would be something that the image loader would do to tell the cache that the operation failed. So, in other words, it is a message from the image loader to the cache.

Here we are trying to do a communication in the other direction, this is, the cache telling the image loader that some image is not required anymore. Therefore rejecting the promise is not the right mechanism.

For the moment I have thought of two ways to achieve this communication from cache to image loader.

  • returning a more complex object from the image loader that has a method to cancel the request.
  • having a method in the loader for cancelling the request associated for a certain imageId

After receiving the message, the imageLoader would cancel the underlying request an do the required clean up; and then reject the promise. So, only the entity that issued the promise should reject it.

swederikcommented, Jun 24, 2017

Hi @leonardorame,

I actually thought I had changed that already. Sorry about that.

I’ve just released version cornerstoneWebImageLoader 0.8.2 with the fix applied:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image Cache - cornerstone
Cornerstone stores Images inside the Image Cache to keep track of memory usage. ... Manually purge the cache of all images (purgeCache); Retrieve...
Read more >
Topic: Purge Cornerstone Cache? | Themeco Community
Is there a way to purge the cornerstone cache? I have purged browser cache ... This can cause stale data to be loaded....
Read more >
Removing image data from cornerstone - Google Groups
Is there a designated way to remove previously loaded image data to unburden the memory as well as to keep data consistent for...
Read more >
Incident Response - Hybrid Analysis
... numberOfImagesCached: cachedImages.length }; } function purgeCache() ... Doing `name + ''` can cause a repl error if the result to `toString` is...
Read more >
cornerstone - Bountysource
"cornerstone-wado-image-loader": "^3.1.2",. Issue. when using loadAndCacheImage it throw an error as "Not a JPEG file" and task "task decodeTask failed ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found