Skip to content

Add offline support with service worker caching#666

Open
uboho-prog wants to merge 1 commit into
StellarDevHub:mainfrom
uboho-prog:implement/offline-mode
Open

Add offline support with service worker caching#666
uboho-prog wants to merge 1 commit into
StellarDevHub:mainfrom
uboho-prog:implement/offline-mode

Conversation

@uboho-prog
Copy link
Copy Markdown

close #584

PR: Implement Offline Mode Support for Learning Content

Summary

This PR adds offline-first support to the frontend learning experience. It introduces a service worker for app shell caching, persistent API response caching for offline read access, and a queued request sync mechanism for offline write operations.

Key Changes

  • Added public/sw.js to cache navigation, assets, and provide an offline fallback.
  • Extended API caching in src/lib/api-cache.ts to persist GET responses in localStorage and serve cached content when offline.
  • Added src/lib/offline-sync.ts for queuing POST/PUT/PATCH/DELETE requests in IndexedDB and flushing them when the app regains connectivity.
  • Integrated offline sync at runtime with src/components/OfflineSyncHandler.tsx.
  • Updated src/app/layout.tsx to include offline notifications and sync handler components.
  • Added tests for API cache behavior and offline sync queue handling.
  • Updated frontend documentation to describe offline mode behavior.

Testing

  • npm test in the frontend package should pass.
  • Manual validation:
    1. Load the app while online and navigate learning content.
    2. Confirm offline-ready notification appears after service worker activation.
    3. Go offline and refresh; previously viewed content should still display.
    4. Perform a write action while offline and verify it syncs automatically when back online.

Notes

  • This implementation focuses on learning content availability and automatic sync for offline write operations.
  • The service worker is scoped to the app and caches both shell assets and navigation responses for better offline reliability.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

@uboho-prog is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

@uboho-prog Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Successfully merging this pull request may close these issues.

[Frontend] Implement Offline Mode Support for Learning Content

1 participant