question-mark
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.

Cache not working as expected

See original GitHub issue

using .toPng method with cacheBust true should not cache the image, unfortunately if the url stays the same and only the query parameters changes, let key = url.replace(/\?.*/, '') this line from src/getBlobFromURL.ts strips away all query parameters and implicitly it caches if the domain stays the same.

Expected Behavior

The url should not be striped away from the query parameters.

Current Behavior

If we have http://google.com?someKey=123, the end result that is used as a key cache is http://google.com

Possible Solution

We can add a option to ignoreQueryParams which will be true by default. But when we need query params to be included in cache key, we can use ignoreQueryParams: false to use all url.

  1. Use an array of images that lives under the same domain, changing them only by query parameters
  2. Switch pages. Personally I used React Router, but I suppose every SPA router will do the trick
  3. Notice how the image gets cached

I can open a PR with the fixed I mentioned above if that’s ok? What do you guys think about this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
osplmcommented, Apr 28, 2022

The PR is still open and the issue is still happening

1reaction
ortonomycommented, May 4, 2022

encountered this problem today. I’m using Next.js’s Image component which caches images on the server as URL query param. Therefore the image is not getting re-rendered when I call toCanvas a second time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring boot Cache not working expected, returning existing ...
In order to fetch channelIds and store them into List, I have used Spring boot @Cacheable annotation but It is not working expected...
Read more >
Why is caching not working? - Help Center - Servebolt.com
When cache is not working as expected, the first thing you want to check is to see wether any caching is happening at...
Read more >
Caching Behavior not working as expected
The problem I am running into is when the poller runs and caches the lookup data when I execute the HTTP flow the...
Read more >
Report Caching Not Working As Expected Report Output is ...
Symptoms · 1. At report level set Properties->Caching Enable Data Caching Set Caching Duration 30 min. Select User level · 2. Run report....
Read more >
Cache on demand not working as expected and making...
I would like to a create a service for ArcGIS Server that will build cache tiles as a user first visits them. I...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found