diff --git a/js/app.js b/js/app.js index 6e9bc26..3c10656 100644 --- a/js/app.js +++ b/js/app.js @@ -31,6 +31,7 @@ try { } // Call after any state mutation to persist automatically +let storageWarned = false; export function saveState() { try { localStorage.setItem(STORAGE_KEY, JSON.stringify({ @@ -39,8 +40,15 @@ export function saveState() { history: state.history, settings: state.settings })); - } catch { - // Storage full or unavailable — silently ignore + } catch (e) { + // Storage full or unavailable — warn once so the user can react (export data) + console.warn('Speichern in localStorage fehlgeschlagen:', e); + if (!storageWarned) { + storageWarned = true; + alert('Achtung: Änderungen konnten nicht gespeichert werden ' + + '(Speicher voll oder nicht verfügbar). Bitte exportiere deine Daten ' + + 'als JSON, um Datenverlust zu vermeiden.'); + } } }