Prevent blob eviction: store as ArrayBuffer + request persistence
iOS Safari evicts Blob file-backed data from IndexedDB under memory pressure, causing upload POSTs to throw 'Load failed' without ever reaching the server. Two-pronged fix: 1. Store photos as ArrayBuffer (inline bytes) instead of Blob (file reference) in IndexedDB — ArrayBuffers are not subject to eviction 2. Request navigator.storage.persist() to signal the browser not to evict our storage under pressure Also adds Storage.getBlob() helper for converting stored ArrayBuffer back to Blob at upload/display time, with backward compat for any existing Blob-stored photos. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
// NextSnap Service Worker
|
||||
// Provides offline-first caching for the app shell
|
||||
|
||||
const CACHE_VERSION = 'nextsnap-v14';
|
||||
const APP_SHELL_CACHE = 'nextsnap-shell-v10';
|
||||
const RUNTIME_CACHE = 'nextsnap-runtime-v10';
|
||||
const CACHE_VERSION = 'nextsnap-v15';
|
||||
const APP_SHELL_CACHE = 'nextsnap-shell-v11';
|
||||
const RUNTIME_CACHE = 'nextsnap-runtime-v11';
|
||||
|
||||
// Assets to cache on install
|
||||
const APP_SHELL_ASSETS = [
|
||||
|
||||
Reference in New Issue
Block a user