Closed aj-4 closed 6 years ago
Yeap, seeing the same issue too. Basically makes the extension unusable in it's current state.
So do I, but not everytimes. GitHub somehow rerenders page, and it makes this extension useless at the first time.
I will try to find a listener api to detect when the page is reloaded, then call contentscript.js
again.
Updated
I found that chrome.webNavigation.onHistoryStateUpdated
did be triggered when the page rerendered, so it would be called twice if entering a non-cache page. I believe GitHub rerenders the page asynchronously. Therefore, the icons are replaced by this extension replaces the icons immediately when the request is completed, then GitHub rerenders the page.
Timeline would be: render(first time) -> extension replaced the icons -> render(second time) request completed -> extension replaced the icons -> render(second time) finished
I have tried a workaround way is to replace icons after delaying execution for 500 ms. Although final result is correct, this will cause icons to flash twice. I couldn't think of alternative way to solve this problem at this moment 😢
would you mind pushing that workaround? if they persist I wouldn't mind a double flash :)
@aj-4 do you think this would be better then the latest version? I'm unsure about it.
https://github.com/OctoLinker/injection this seems work though.
@xxhomey19 imo that'd be a great workaround
@aj-4 Me too, but I'm still trying to find a better solution. I think someone has developed browser extension on GitHub should also get this problem.
Icons will show briefly and disappear on initial page load. They work as expect on refresh and with cached pages.
It seems they are being loaded then replaced by the default svg graphic. Are others having this issue?