docs: correct routes in offline sync documentation
fix: remove non-existent routes from sw.js pre-caching
This commit is contained in:
@@ -62,13 +62,14 @@ A critical feature is the ability to link tasting notes to a bottle that hasn't
|
||||
|
||||
## 📱 PWA Features
|
||||
|
||||
### Service Worker (`public/sw.js`)
|
||||
- **Strategy**: Network-First. Attempts to fetch from network, falls back to cache if offline.
|
||||
- **Cache Bypassing**: Explicitly bypasses cache for:
|
||||
- `*/auth/*`
|
||||
- `*/api/*`
|
||||
- `*.supabase.co/*`
|
||||
- **Asset Caching**: Caches static assets (`manifest.json`, icons) during installation.
|
||||
### Service Worker (`public/sw.js`) - "Ironclad" Strategy
|
||||
The Service Worker implements an aggressive offline reliability strategy:
|
||||
|
||||
- **Pre-Caching**: The landing page (`/`) and core static assets are cached during installation.
|
||||
- **Fail-Fast Navigation**: Navigation requests have a 3-second timeout to prevent UI hangs during network transitions.
|
||||
- **Root App Shell Fallback**: If a URL is not found in the cache while offline, the SW serves the Root (`/`). This allows Next.js to bootstrap and handle the routing client-side using local Dexie data.
|
||||
- **RSC Data Resiliency**: Requests to `/_next/data/` return an empty JSON object if they fail, preventing "Application Error" screens.
|
||||
- **Stale-While-Revalidate**: Applied to static assets to ensure immediate UI response.
|
||||
|
||||
### Manifest (`src/app/manifest.ts`)
|
||||
Defines the app's appearance when installed:
|
||||
@@ -83,9 +84,10 @@ Defines the app's appearance when installed:
|
||||
- `src/lib/db.ts`: Database definition and TypeScript interfaces.
|
||||
- `src/hooks/useBottleData.ts`: Example of the SWR pattern implementation.
|
||||
- `src/components/UploadQueue.tsx`: The "Sync Engine" UI and logic coordinator.
|
||||
- `src/components/CameraCapture.tsx`: Integrated scanning feature.
|
||||
- `src/components/TastingNoteForm.tsx`: Integrated tasting note feature.
|
||||
- `src/components/PWARegistration.tsx`: Client-side Service Worker registration handler.
|
||||
|
||||
## ⚠️ Edge Case Handling
|
||||
- **Partial Sync**: If a scan succeeds but a tasting fails, the tasting remains in the queue with the now-valid `bottle_id`.
|
||||
- **Duplicate Scans**: The system relies on the user not submitting the same scan multiple times while offline (UI prevents multiple clicks).
|
||||
- **Stale Cache**: Caches are overwritten on every successful online fetch to ensure eventual consistency.
|
||||
|
||||
@@ -2,9 +2,7 @@ const CACHE_NAME = 'whisky-vault-v4'; // Increment version for "Ironclad" strate
|
||||
|
||||
// CONFIG: Core pages and assets to pre-cache immediately on install
|
||||
const CORE_PAGES = [
|
||||
'/', // Dashboard / Home
|
||||
'/tasting/new', // Critical: Add Tasting Screen
|
||||
'/scan', // Critical: Scan Screen
|
||||
'/', // Dashboard / Home (Includes Scan and Tasting features)
|
||||
];
|
||||
|
||||
const STATIC_ASSETS = [
|
||||
|
||||
Reference in New Issue
Block a user