Skip to content

[ENHANCEMENT] Service worker lacks install-time pre-caching - app not truly offline capable #55

Description

@Siddh2024

Description

The service worker (public/sw.js) has no install-time pre-caching. The install event only calls self.skipWaiting() but never opens a cache or pre-caches any assets. The etch handler uses a network-first strategy, meaning the first load with the SW fetches everything from the network. If the user goes offline immediately after, only incidentally fetched resources are cached.

The README claims "100% Offline Capable" and "Assets are aggressively cached by a service worker for instant loading times" — but these claims are not met without pre-caching.

Location

public/sw.js lines 3-5

Current Code

javascript self.addEventListener("install", () => { self.skipWaiting(); });

Suggested Fix

Add pre-caching of critical assets:
javascript self.addEventListener("install", (event) => { event.waitUntil( caches.open(CACHE_NAME).then((cache) => { return cache.addAll([ "/", "/index.html", "/manifest.json", "/cube-icon.png", ]); }) ); self.skipWaiting(); });

Please assign this issue to me @Siddh2024 so I can fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions