Skip to content

Commit

Permalink
CB-5450 purge cache if quota error happens (#2917)
Browse files Browse the repository at this point in the history
* CB-5450 purge cache if quota error happens

* CB-5450 cache only images from the same origin

* CB-5450 change window to self

* CB-5450 revert purgeOnQuotaError

---------

Co-authored-by: Evgenia Bezborodova <[email protected]>
  • Loading branch information
devnaumov and EvgeniaBzzz authored Sep 17, 2024
1 parent 3ca9904 commit 30e74ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion webapp/packages/core-browser/src/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ registerRoute(
);

registerRoute(
({ request }) => request.destination === 'image',
({ request, url }) => url.origin === self.location.origin && request.destination === 'image',
new CacheFirst({
cacheName: 'images',
plugins: [
Expand All @@ -127,6 +127,7 @@ registerRoute(
new ExpirationPlugin({
maxEntries: 1000,
maxAgeSeconds: 7 * 24 * 60 * 60,
purgeOnQuotaError: true,
}),
],
}),
Expand Down

0 comments on commit 30e74ce

Please sign in to comment.