Fix: delete entry from 'localStorage'

This commit is contained in:
Pieter Vander Vennet 2024-09-24 17:24:05 +02:00
parent d1fed39fcb
commit 22c8a45012

View file

@ -30,6 +30,10 @@ export class LocalStorageSource {
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:" + key) const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:" + key)
source.addCallback((data) => { source.addCallback((data) => {
if(data === undefined || data === "" || data === null){
localStorage.removeItem(key)
return
}
try { try {
localStorage.setItem(key, data) localStorage.setItem(key, data)
} catch (e) { } catch (e) {