rafaelgomesxyz / esgst

An extension that enhances SteamGifts / SteamTrades.
MIT License
146 stars 23 forks source link

Implement a method to better handle marking discussions as visited across multiple tabs #299

Closed killergege closed 6 years ago

killergege commented 6 years ago

My usual "pattern" for reading discussions is sorting them as I wish, and middle click them all (=open in new tab but keeping focus on current tab) until I get to the last topic I read, and only then read all tabs one by one (on Google Chrome). But it seems that if I do that, ESGST doesn't mark the discussions are read.

Although, if I middle click AND go to the new opened tab right away, the page is properly marked as read.

Could you make the discussion as read just by visiting the tab ? Without it being related to the way it has been opened or if several tabs has been opened at once.

rafaelgomesxyz commented 6 years ago

That's already how it works, I cannot reproduce what you describe at all. Is it always reproduceable?

killergege commented 6 years ago

Yes, it happens very often and the other times it's not reliable. For instance, this is how the discussion section opened today. I middle clicked the five first tabs and checked them out one by one. screen1

And this is how the discussion section displayed after reloading the page screen2

rafaelgomesxyz commented 6 years ago

Try checking the console in the discussions that weren't marked, I made several tests and they all worked fine.

Maybe you're closing them too fast?

Are you on script or extension?

killergege commented 6 years ago

Nothing in the console log, I'm using the script version, so I tried disabling all other TamperMonkey scripts and all the other Chrome extensions. It still happens. I tried to look in the code, but didn't find where the page is marked as visited (to try to debug it myself, as I can reproduce it), could you point me the function name / line of code that is called to mark the page as visited ?

Usually the first page is properly marked as visited, for the others it seems random.

rafaelgomesxyz commented 6 years ago

The page is marked as visited in the line that says savedComments[code].visited = true;

rafaelgomesxyz commented 6 years ago

That's if Comment Tracker is disabled. If Comment Tracker is enabled, it's marked as visited in the line that says saved[comment.type][comment.code].visited = true;

rafaelgomesxyz commented 6 years ago

I think it could be the script not being able to save everything, because I use the extension and I cannot reproduce it.

rafaelgomesxyz commented 6 years ago

@killergege Is this still reproduceable for you?

killergege commented 6 years ago

It still happens everyday (although I didn't check the last version from this weekend), I didn't take the time to debug.

But I can also reproduce it on my android phone, with Firefox and the ESGST extension : if I do a long press and select "open in a new tab" on several entries and then go read each tab, they are not marked are read, but if I do a simple tap on a discussion, it opens the tab and if I reload the discussion page, it is properly marked as read. I'll try to test that with Firefox on my windows machine

rafaelgomesxyz commented 6 years ago

I'll test again later.

killergege commented 6 years ago

I usually use Chrome+Tampermonkey script but tried on my FF. So I could reproduce it on Firefox 57 with the ESGST extension v7.13.1 :

If I left-click on the link and use the Back button, it works If I middle-click and immediately check the opened tab, it works.

Attached you'll find my settings exported, in case it's some conflicting parameters esgst_settings_2018-01-16T23_29_20.401Z.json.txt

rafaelgomesxyz commented 6 years ago

I'm guessing it's because when you close the discussion it has not saved yet. While one tab is saving the other has to wait for that tab to finish saving so it can save, to prevent data conflict. With Comment Tracker enabled it's easier to find out when that happens because after the discussion is saved the eye icons appear next to the comments, so you can safely close the discussion after that.

I'm currently trying to see if I can improve the saving when multiple tabs are open somehow.

rafaelgomesxyz commented 6 years ago

I added a method that should help deal with this to the next version. I'll try to release it tomorrow and then you let me know.

rafaelgomesxyz commented 6 years ago

New version has been released, can you check?