Skip to content

expireEntries() does not remove cache entries #3411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kylemeenehan opened this issue May 8, 2025 · 1 comment
Open

expireEntries() does not remove cache entries #3411

kylemeenehan opened this issue May 8, 2025 · 1 comment

Comments

@kylemeenehan
Copy link

Hi there! Thanks for the great library!

This was working before, with no change in version of workbox packages, so I'm wondering whether this is a change in Google Chrome or its underlying dependencies?

Currently I have some code that clears out a cache when a POST request is successful. It's been working fine until recently, but now when testing it appears to not clear the cache.

This is an excerpt of my code:

...
    const searchExpiration = new CacheExpiration("tags-search", {
        maxAgeSeconds: 60
    });

registerRoute(
        ({ url, sameOrigin }) => {
            return sameOrigin && url.pathname.includes("/api/v1/tags");
        },
        new NetworkOnly({
            plugins: [
                {
                    fetchDidSucceed: async ({ response }) => {
                        /**
                         * When we create a new tag, the data in the backend changes and we need
                         * to invalidate the local cache for the search queries.
                         */


                        console.log('expiring entries for search')

                        searchExpiration.expireEntries();

...
redacted
...

                        return response;
                    }
                }
            ]
        }),
        "POST"
    );
...

I do see expiring entries for search in the console, so the route handler is happy, but the caches are still present in the "tags-search" cache after calling expireEntries().

Google Chrome version: Version 135.0.7049.115 (Official Build) (arm64)

@kylemeenehan
Copy link
Author

I've tried in Edge and Firefox and I get the same problem. Updated workbox packages from 7.0.0 to 7.3.0 and I still get the same problem. I'm trying to download an older version of Chromium, but it appears that these instructions are out of date: https://www.chromium.org/getting-involved/download-chromium/#downloading-old-builds-of-chrome-chromium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant