feat(waiter): keep the menu's photos for offline (platform-v2 step 5.2)
Right after the menu is read the phone downloads its photos (4 at a time, services/photoCache.js). The library's year-long immutable headers keep them in the browser cache; the installed PWA also caches /api/media/file/ cache- first (workbox `xenia-media`). With no connection the menu still shows them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,7 +64,17 @@ export default defineConfig(({ mode }) => {
|
||||
},
|
||||
workbox: {
|
||||
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
|
||||
runtimeCaching: [],
|
||||
// The media library's files (plan step 5.2): an address never changes meaning
|
||||
// (/api/media/file/<hash>/<size>), so the cached copy is always right: cache first.
|
||||
runtimeCaching: [{
|
||||
urlPattern: ({ url }) => url.pathname.startsWith('/api/media/file/'),
|
||||
handler: 'CacheFirst',
|
||||
options: {
|
||||
cacheName: 'xenia-media',
|
||||
expiration: { maxEntries: 800, maxAgeSeconds: 365 * 24 * 3600 },
|
||||
cacheableResponse: { statuses: [0, 200] },
|
||||
},
|
||||
}],
|
||||
},
|
||||
devOptions: {
|
||||
enabled: false,
|
||||
|
||||
Reference in New Issue
Block a user