fix(ios): prepare the app shell before finishing offline downloads

Download the app shell as part of explicit offline preparation on iOS. Refuse to mark a build ready if any asset fetch returns an HTTP error, and invalidate success markers recorded by the old logic.

Refs #3318
This commit is contained in:
Maurice
2026-12-05 12:24:23 +01:00
parent 908e4e1f8b
commit f7c45a2d85
5 changed files with 77 additions and 10 deletions
+14
View File
@@ -100,6 +100,20 @@ describe('keepOfflineShellFresh', () => {
expect(fetched).toContain('/assets/fr-bbbb2222.js');
});
it('retries the iOS warm-up when a route chunk returned an HTTP error', async () => {
const fetchImpl = vi.fn(async (input: RequestInfo | URL) => {
if (String(input) === '/asset-manifest.json') return new Response(JSON.stringify(manifest));
if (String(input) === '/assets/AtlasPage-99887766.js') return new Response(null, { status: 503 });
return new Response('asset');
});
await keepOfflineShellFresh(fetchImpl);
expect(fetchImpl).toHaveBeenCalledWith('/assets/AtlasPage-99887766.js', { priority: 'low' });
fetchImpl.mockClear();
await keepOfflineShellFresh(fetchImpl);
expect(fetchImpl).toHaveBeenCalledWith('/assets/AtlasPage-99887766.js', { priority: 'low' });
});
it('on Android hands the list to the native store instead of fetching it here', async () => {
vi.mocked(TrekShell.refreshOfflineCopy).mockResolvedValue({ saved: true, complete: true });
const fetchImpl = vi.fn(async (input: RequestInfo | URL) => {