Problem
A PWA can appear installed yet serve stale application files or behave unpredictably after deployment if caching is not designed deliberately.
Engineering Context
Business applications often change frequently and may call cross-origin APIs. The service worker must not accidentally cache sensitive or dynamic responses.
Design Considerations
Version caches, prefer network-first handling for navigation/application bundles, and avoid intercepting unrelated authenticated API traffic.
Architecture
Browser → service worker → app shell/static cache, while application API requests continue to their origin using normal browser networking.
Trade-offs
Aggressive offline caching improves resilience but increases stale-version risk. Conservative caching is often better for operational applications.
Implementation Pattern
Use an explicit service-worker version, clear old caches on activation, provide an update path and test the deployed scope/start URL.
When to Use It
Useful when users benefit from installability, fast repeat loads and app-like access without requiring a native app for every workflow.
Common Mistakes
Caching HTML forever; registering the worker outside its intended scope; intercepting authenticated backend requests; forgetting update UX.
Conclusion
For business software, predictable updates are usually more important than maximal offline behaviour.
