From 0cbcfcc7d993a8f788b52f2352280e7cffdfbc66 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 12 May 2024 22:32:58 +1200 Subject: [PATCH] Fixed bool type & RYD store --- materialious/src/lib/externalSettings.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/materialious/src/lib/externalSettings.ts b/materialious/src/lib/externalSettings.ts index 66570a97..20a693db 100644 --- a/materialious/src/lib/externalSettings.ts +++ b/materialious/src/lib/externalSettings.ts @@ -17,6 +17,7 @@ import { playerSavePlaybackPositionStore, playerTheatreModeByDefaultStore, returnYTDislikesInstanceStore, + returnYtDislikesStore, sponsorBlockCategoriesStore, sponsorBlockStore, sponsorBlockUrlStore, @@ -83,7 +84,7 @@ const persistedStores = [ }, { name: 'returnYtDislikes', - store: returnYTDislikesInstanceStore, + store: returnYtDislikesStore, type: 'boolean' }, { @@ -157,12 +158,18 @@ function setStores(toSet: Record) { if (store.type === 'array') { value = paramValue.split(','); } else if (store.type === 'boolean') { - value = paramValue === 'true'; + value = typeof paramValue === 'string' ? paramValue === 'true' : paramValue; } else { value = paramValue; } store.store.set(value); + + // Kinda backwards but delete out of localstorage after setting + // So can be changed in the future. + try { + localStorage.removeItem(store.name); + } catch { } } }); }