Update preferences store to handle dates in telemetryRequested item

This commit is contained in:
Fred Boniface committed 2025-10-13 00:41:19 +01:00
1 parent a725dfdc4d
commit 65856adb33
1 file changed
+9 -1
+9 -1
View File
@@ -25,7 +25,15 @@ function createPreferencesStore() {
let stored: Preferences;
try {
const json = localStorage.getItem(STORAGE_KEY);
stored = json ? JSON.parse(json) : DEFAULT_PREFERENCES;
if (json) {
stored = JSON.parse(json);
// Convert telemetryRequested back to Date if it exists
stored.telemetryRequested = stored.telemetryRequested
? new Date(stored.telemetryRequested)
: null;
} else {
stored = DEFAULT_PREFERENCES;
}
} catch {
stored = DEFAULT_PREFERENCES;
}