Skip to content

Commit

Permalink
fix: undefined is being added to Slur list when added using right cli…
Browse files Browse the repository at this point in the history
…ck (#392)
  • Loading branch information
aatmanvaidya authored Oct 3, 2023
1 parent 19b7a96 commit 623f57e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions browser-extension/plugin/src/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 623f57e

Please sign in to comment.