mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
config.ts: Fix :sanitise tridacyl{local,sync} breaking config.get()
This commit is contained in:
parent
e710296d70
commit
8ccc9e3bb5
1 changed files with 8 additions and 2 deletions
|
@ -475,9 +475,15 @@ async function init() {
|
|||
|
||||
// Listen for changes to the storage and update the USERCONFIG if appropriate.
|
||||
// TODO: BUG! Sync and local storage are merged at startup, but not by this thing.
|
||||
browser.storage.onChanged.addListener((changes, areaname) => {
|
||||
browser.storage.onChanged.addListener(async (changes, areaname) => {
|
||||
if (CONFIGNAME in changes) {
|
||||
USERCONFIG = changes[CONFIGNAME].newValue
|
||||
// newValue is undefined when calling browser.storage.AREANAME.clear()
|
||||
if (changes[CONFIGNAME].newValue !== undefined) {
|
||||
USERCONFIG = changes[CONFIGNAME].newValue
|
||||
} else if (areaname === (await get("storageloc"))) {
|
||||
// If newValue is undefined and AREANAME is the same value as STORAGELOC, the user wants to clean their config
|
||||
USERCONFIG = o({})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue