The app persists everything needed to resume work across page reloads in localStorage. Nothing is ever sent off-device.
| Key | Written by | Contents |
|---|---|---|
auditClientViewer_session_v1 |
saveSession() |
{ fileName, allData, completedData, savedAt } — the parsed rows plus metadata. |
theme |
theme toggle handler | 'dark' or 'light'. |
The browser's File API deliberately does not expose absolute paths (only the File object and its bytes). Storing the file path is impossible without a desktop wrapper (Electron etc.). Saving the parsed rows achieves the same user-visible outcome — a refresh restores the session — without re-prompting for the file.
saveSession() serializes {fileName, allData, completedData, savedAt} to JSON and writes the storage key. It is called after every mutation that changes the session state:
parseCSV()— after a successful upload.markRecordComplete()— after moving a row to Completed.restoreRow()— after moving a row back to Active.
If localStorage throws (quota exceeded, storage disabled), the error is logged to the console and the app keeps working in-memory — progress is just not persisted for that session.
On DOMContentLoaded, restoreFromSession() runs:
- Reads the storage key and
JSON.parses it. - If present and valid, repopulates
allData,completedData,currentFileName,filteredData, andcurrentWorkbook. - Calls
showListView()+showContent()so the user lands on the Active tab. - Shows a toast:
Restored "<filename>" (N active, M completed).
If the key is missing or corrupt the app falls back to the normal upload-first flow.
resetToUploadState() (fired by the 🔄 New Upload button after a confirm prompt):
localStorage.removeItem('auditClientViewer_session_v1').- Null out every piece of state.
- Hide
#contentArea, show#uploadZone. - Show a toast:
Session cleared. Upload a new CSV file to begin.
The storage key is suffixed with _v1. If the on-disk shape needs to change, bump to _v2 and the old session will simply be ignored (user re-uploads). This avoids the need for a migration layer inside a small tool.
localStorage is typically 5–10 MB per origin. The session stores the parsed rows, not the raw CSV — JSON serialization is usually 1.5–2× the CSV size. A 10 MB CSV can therefore be near the edge; large sessions may fail to save. If that happens, the console will log a warning and completed state will only persist for the current tab lifetime.