diff --git a/browser-extension/plugin/src/content-script.js b/browser-extension/plugin/src/content-script.js index 71f02592..c76f2e44 100644 --- a/browser-extension/plugin/src/content-script.js +++ b/browser-extension/plugin/src/content-script.js @@ -96,20 +96,17 @@ chrome.runtime.onMessage.addListener(async function (request) { log('slur added from bg', slur); const pref = await getPreferenceData(); let slurList; - if (!pref) { + if (!pref || !pref.slurList) { slurList = slur; - await setPreferenceData({ ...pref, slurList }); } else { - // let { slurList } = pref; slurList = pref.slurList; if (!slurList || slurList === '') { - slurList += slur; + slurList = slur; } else { slurList += `,${slur}`; } - await setPreferenceData({ ...pref, slurList }); } - + await setPreferenceData({ ...pref, slurList }); return true; } if (request.type === 'ULI_ENABLE_TOGGLE') {