return-youtube-dislike
return-youtube-dislike copied to clipboard
Add extension opt-in option to show update popup
Add an opt-in option to display a new tab for changelog after each update. Default is disabled, which means you won't see updates. This comes after PR #537 with a temporary cherry pick. Tell me to rebase once that one is merged. Improves #534 Part of #539
Added Do Not Merge tag. Reason: Use of extConfig
in background script may cause race condition. The service worker is supposed to load or initialize user options, instead of using it.
This is an ongoing discussion. Keep this PR, may be adapted by #537. Cherry pick if convenient. Close when #537 is resolved.
Basically.... I saw v3.0 popup more than 20 times, just because I've got multiple accounts on multiple computers.
3.0.1 is submited to the store for review.
@cyrildtm, do you use chrome canary?
@cyrildtm, do you use chrome canary?
Yes I'm on 103.0.5027.0 for developing this extension. Now I'm making one more fix. Will explain in a second.
EDIT: If you meant why I've got so many popups, no I'm still on 100, and some of my computers still have 99. I don't update that often and I hate my tabs disappear. With v3.0, every time each computer and each account gets an update, I see a popup.
An event listener for onInstalled is still a better solution. Here's an simple experiment:
in background js, add api.tabs.create({url: "about:blank"});
at the top level.
Wait until the service worker goes "inactive"; This can be easily observed when you have chrome://extensions/ open, while reading through this page explaining why service workers get terminated frequently.
Then, open extension settings and flip a switch. You will see a new tab.
Conclusion, background js (or service worker, whatever you call it) gets re-run frequently. It's quite a waste to read options. And why.
And .... https://github.com/Anarios/return-youtube-dislike/blob/2c39c096be468954ba30d9c4fb7bc55f789e020d/Extensions/combined/ryd.background.js#L81
This version will never get a popup 😃
And ....
https://github.com/Anarios/return-youtube-dislike/blob/2c39c096be468954ba30d9c4fb7bc55f789e020d/Extensions/combined/ryd.background.js#L81
This version will never get a popup 😃
It gets a popup only on install, just as intended for now.
It's quite a waste to read options.
Is it an expensive operation, though? I thought that it costs almost nothing.
It gets a popup only on install, just as intended for now.
I just noticed your words "for now". Okay, but we will need it to actually work in the future right?
it costs almost nothing.
A non-zero cost action is not nothing. Currently we have seven options and therefore seven async gets to read the options, separately. One can justify "separately" with text clarity and async gets bunched anyway. This little feature causes another two async reads, which is +28%. Do it two million times. Not because we sacrifice efficiency for tidiness, but simply because we can. So yes, it is a waste.
Service worker gets killed and reinstated quite often, it's not like once every browser update. That's my understanding.
Okay, but we will need it to actually work in the future right?
If there are ever changes big enough that everyone needs to be notified - then yeah. Right now I thought that showing it only on install is sufficient. I wanted to release the fix ASAP to not annoy people with Canary, so I went with the simplest solution of just disabling it.
This little feature causes another two async reads
Can be refactored into a single init function that reads all settings in one go.
Service worker gets killed and reinstated quite often
Every few minutes, if I'm not wrong.
Refactoring can solve everything together. Will do the following when I get ~~back~~ time
- Step back with this PR
- Make a new PR to refactor all
initialize
andhandle
functions. Make sure to keep text clarity. (I wanted to streamlinehandle
as well since if the other is gone then this looks weird being left behind) - Re-prettify popup.html, make it consistent with main website's style. We need a scroll bar for the switches now.
I just got a popup myself .. browser restart, no updates, extension is already 3.001. .. and I just got another one, browser restart and update.
Let's fix this bug once for all. The code looks messy but let's hope it catches "most" of the rare cases users are complaining.
I went a bit pedantic in the comments in source code. Please keep them to let people in the future know what's going on with this ugly logic.
@sy-b @Anarios Please take a look and comment. Remember people complaining on Github or Chrome Web Store represent ~0.1% of all extension users, who represent ~0.1% of all Youtube users. (I don't use Discord so I have no idea) Let's get over this.
See my bug report #597