Skip to content

Commit

Permalink
refactor: encapsulated local forage in local cache to ensure the righ…
Browse files Browse the repository at this point in the history
…t instance is always used
  • Loading branch information
claustres committed Dec 23, 2024
1 parent e36d269 commit fc2dc5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src-pwa/custom-service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ExpirationPlugin } from 'workbox-expiration'
import logger from 'loglevel'
import { LocalForage } from '@kalisio/feathers-localforage'
// Ensure same underlying configuration as we are in another process and instance may differ
LocalForage.config({
const storage = LocalForage.createInstance({
name: 'offline_cache',
storeName: 'cache_entries'
})
Expand All @@ -29,7 +29,7 @@ setInterval(async () => {
if (updatingCachedUrls) return
updatingCachedUrls = true
cachedUrls = new Map()
await LocalForage.iterate((value, key) => {
await storage.iterate((value, key) => {
cachedUrls.set(key, value)
})
updatingCachedUrls = false
Expand Down

0 comments on commit fc2dc5d

Please sign in to comment.