Skip to content

Offline Mode and Caching Strategy

Ultra PDF Editor is built to operate offline. Astro ships static content, while the React editor island and pdf.js/pdflib bundles can be cached via the service worker.

Caching tiers

  1. App shell: HTML, CSS, fonts, and small JS bundles precache during the service worker install event.
  2. Editor chunk: The heavy editor bundle (pdf.js worker + pdf-lib) uses a stale-while-revalidate strategy so repeat visits load instantly while updates stream in behind the scenes.1
  3. User PDFs: Files never persist automatically. Offer the optional “remember recent files” toggle (planned) to store encrypted blobs in IndexedDB.

Testing offline behavior

  1. Run npm run dev.
  2. Open the app in Chrome, start Lighthouse from DevTools, and enable the Service Worker audit.
  3. Toggle Offline in the Network panel to confirm the editor still boots and previously loaded docs render from cache.

Handling updates

Footnotes

  1. Google Chrome team, The Offline Cookbook, web.dev/articles/offline-cookbook.