younesaassila / ttv-lol-pro

TTV LOL PRO removes most livestream ads from Twitch. This is free, don't expect it to be perfect.
GNU General Public License v3.0
1.44k stars 29 forks source link

Whitelisting a channel sometimes adds that channel to the whitelist multiple times, creating multiple entries #303

Closed younesaassila closed 7 months ago

younesaassila commented 7 months ago

image

younesaassila commented 7 months ago

Should clarify: whitelisted the channel from the extension popup

younesaassila commented 7 months ago

The problem is that a new whitelist button click event listener keeps being added every time the stats get refreshed!

Should check whole project for addEventListeners leaks sendMessageAndWaitForResponse doesn't remove the message event listener if successful, this should be fixed. Also store should auto remove all load event listeners once it dispatched all of them. URL.revokeObjectURL

younesaassila commented 7 months ago

To fix: Move event listener outside of setWhitelistStatus. setWhitelistStatus should set attribute data-channel on whitelist button so event listener knows the channel to whitelist