mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 18:54:17 +00:00
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:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user