feat(shopping): Service-Worker network-only fuer /api/shopping-list/*
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 2m25s

Einkaufsliste-Endpunkte duerfen vom SW nie gecached werden — Liste
ist zustaendig fuer Check-States und muss immer live vom Server
gelesen werden. Test + resolveStrategy-Erweiterung analog zu den
anderen online-only-Endpunkten.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-21 23:28:17 +02:00
parent e53cdc96fe
commit dc15cf04a9
2 changed files with 8 additions and 1 deletions

View File

@@ -17,7 +17,8 @@ export function resolveStrategy(req: RequestShape): CacheStrategy {
path === '/api/recipes/import' ||
path === '/api/recipes/preview' ||
path === '/api/recipes/extract-from-photo' ||
path.startsWith('/api/recipes/search/web')
path.startsWith('/api/recipes/search/web') ||
path.startsWith('/api/shopping-list')
) {
return 'network-only';
}

View File

@@ -30,6 +30,12 @@ describe('resolveStrategy', () => {
expect(resolveStrategy({ url: '/api/recipes/search/web?q=x', method: 'GET' })).toBe('network-only');
});
it('network-only for /api/shopping-list/*', () => {
expect(resolveStrategy({ url: '/api/shopping-list', method: 'GET' })).toBe('network-only');
expect(resolveStrategy({ url: '/api/shopping-list/recipe/5', method: 'GET' })).toBe('network-only');
expect(resolveStrategy({ url: '/api/shopping-list/check', method: 'GET' })).toBe('network-only');
});
it('shell bucket for build/static assets', () => {
expect(resolveStrategy({ url: '/_app/immutable/chunks/x.js', method: 'GET' })).toBe('shell');
expect(resolveStrategy({ url: '/icon-192.png', method: 'GET' })).toBe('shell');