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
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:
@@ -17,7 +17,8 @@ export function resolveStrategy(req: RequestShape): CacheStrategy {
|
|||||||
path === '/api/recipes/import' ||
|
path === '/api/recipes/import' ||
|
||||||
path === '/api/recipes/preview' ||
|
path === '/api/recipes/preview' ||
|
||||||
path === '/api/recipes/extract-from-photo' ||
|
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';
|
return 'network-only';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,12 @@ describe('resolveStrategy', () => {
|
|||||||
expect(resolveStrategy({ url: '/api/recipes/search/web?q=x', method: 'GET' })).toBe('network-only');
|
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', () => {
|
it('shell bucket for build/static assets', () => {
|
||||||
expect(resolveStrategy({ url: '/_app/immutable/chunks/x.js', method: 'GET' })).toBe('shell');
|
expect(resolveStrategy({ url: '/_app/immutable/chunks/x.js', method: 'GET' })).toBe('shell');
|
||||||
expect(resolveStrategy({ url: '/icon-192.png', method: 'GET' })).toBe('shell');
|
expect(resolveStrategy({ url: '/icon-192.png', method: 'GET' })).toBe('shell');
|
||||||
|
|||||||
Reference in New Issue
Block a user