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:
@@ -2,6 +2,7 @@ import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useEffect, useState } from 'react'
|
||||
import client from '../api/client'
|
||||
import db from '../db/posdb'
|
||||
import { warmPhotos } from '../services/photoCache'
|
||||
|
||||
export const PRODUCTS_KEY = ['products']
|
||||
|
||||
@@ -15,6 +16,7 @@ async function fetchAndCacheProducts() {
|
||||
|
||||
db.products.bulkPut(products).catch(() => {})
|
||||
db.categories.bulkPut(categories).catch(() => {})
|
||||
warmPhotos(products, categories) // kept for offline (5.2)
|
||||
|
||||
return { products, categories }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user