I currently have some code using jQuery Deferred and ajax to call remote api and get the data and put in localStorage and get data from localStorage. This code seems buggy the first time it runs (i.e. it doesn’t render the data until browser refresh) but it works perfectly after that until the cache exp…
Tag: caching
Angular MatStepper fails to recognize cached values from two str arrays (but successfully recognizes values from another str array)
I have a MatStepper that’s used to navigate to the next page of a signup flow. I also have a method that loads values from a cache if it’s available, and if so then the MatStepper skips to Page 2. After that, a future method pre-fills the form will those cached values. The scenario where cachedSpo…
Nextjs static files CORS issue – Causing links to break on version 10.1.4
My current Nextjs app is pulling its static files from Cloudfront. (I upload the /static folder to S3 during the deployment) Since updating to version 9 I am facing a weird issue where some of my CSS files are getting the following CORS error: After updating Nextjs to version 10.1.4, all the links of the app …
Service worker – update cache on new version using skipWaiting()
I have implemented Workbox to generate my service worker using webpack. This works – I can confirm revision is updated in the generated service worker when running “generate-sw”: “workbox inject:manifest”. The problem is – I have noticed my clients are not updating the cach…
Service Workers – selectively choose resources
I have a simple Service Worker implementation like this: My goal is to cache all resources except the two files indicated in the urlsToCache variable, these two files should ALWAYS be requested from the network.. How can i achieve this? How can I then verify that it is actually so? Answer You can check the ur…
Memoize a curried function
Is it possible to memoize f with regard to the 2 arguments, namely: Answer You could take a Map as cache and take nested maps for all following arguments. This cache works for arbitrary count of arguments and reuses the values from the former calls. It works by taking a curried function and an optional Map. I…
require.cache equivalent in ES modules
ES Modules docs states: require.cache is not used by import. It has a separate cache. So where’s this separate cache? Is it accessible after all? I’m looking for invalidating module caching as it can be done in CommonJS modules (node.js require() cache – possible to invalidate?) Answer I saw…
Invalidate node cache when using Jest
I have a file with object that gets populated with process.env properties: env.js Now I try to test this file with different process.env properties: env.test.js Unfortunately, even though I try to load the file in every test separately the file gets loaded only once, making the third test fail with: P.S. It d…
Using multiple javascript service workers at the same domain but different folders
My website offers an array of web apps for each client. Each client has a different mix of apps that can be used. Each web app is a hosted in a different folder. So I need to cache for each client only it’s allowed web apps instead of caching all the apps, many of them he the user, will not
how to clear cache using javascript when starting Offline application
I need a help to clear cache using Javascript, Is it possible to clear cache using Javascript?. I have developed a Offline Chrome application using Javascript & Node WebKit. When using this application, the cache sizes increasing more day by day. So I want to delete cache directory or clearing cache from …