From 46e1ce717efa9a7528230c32c00d26da786e53f2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 27 Apr 2025 18:03:50 +1000 Subject: [PATCH 1/2] Update ClassPreferences.js --- src/lib/ClassPreferences.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/lib/ClassPreferences.js b/src/lib/ClassPreferences.js index 9640fc9e1f..18448e993b 100644 --- a/src/lib/ClassPreferences.js +++ b/src/lib/ClassPreferences.js @@ -1,19 +1,12 @@ -const VERSION = 1; // In case we ever need to invalidate these -const cache = {}; export function updatePreferences(prefs, appId, className) { try { localStorage.setItem(path(appId, className), JSON.stringify(prefs)); } catch { // Fails in Safari private browsing } - cache[appId] = cache[appId] || {}; - cache[appId][className] = prefs; } export function getPreferences(appId, className) { - if (cache[appId] && cache[appId][className]) { - return cache[appId][className]; - } let entry; try { entry = @@ -29,10 +22,7 @@ export function getPreferences(appId, className) { return null; } try { - const prefs = JSON.parse(entry); - cache[appId] = cache[appId] || {}; - cache[appId][className] = prefs; - return prefs; + return JSON.parse(entry); } catch { return null; } From eb821d54c30456e31bcf3760350452999647675d Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 27 Apr 2025 19:26:49 +1000 Subject: [PATCH 2/2] Update ClassPreferences.js --- src/lib/ClassPreferences.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/ClassPreferences.js b/src/lib/ClassPreferences.js index 18448e993b..7e871de5e5 100644 --- a/src/lib/ClassPreferences.js +++ b/src/lib/ClassPreferences.js @@ -1,3 +1,4 @@ +const VERSION = 1; // In case we ever need to invalidate these export function updatePreferences(prefs, appId, className) { try { localStorage.setItem(path(appId, className), JSON.stringify(prefs));