From 22c8a45012be60dad215f8b0d72501133665454e Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 24 Sep 2024 17:24:05 +0200 Subject: [PATCH] Fix: delete entry from 'localStorage' --- src/Logic/Web/LocalStorageSource.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Logic/Web/LocalStorageSource.ts b/src/Logic/Web/LocalStorageSource.ts index 601324aeb..0923a4a7c 100644 --- a/src/Logic/Web/LocalStorageSource.ts +++ b/src/Logic/Web/LocalStorageSource.ts @@ -30,6 +30,10 @@ export class LocalStorageSource { const source = new UIEventSource(saved ?? defaultValue, "localstorage:" + key) source.addCallback((data) => { + if(data === undefined || data === "" || data === null){ + localStorage.removeItem(key) + return + } try { localStorage.setItem(key, data) } catch (e) {