CyberShadow / DFeed

D news aggregator, newsgroup client, web newsreader and IRC bot
http://forum.dlang.org/help#about
380 stars 35 forks source link

Refresh "read threads" state when navigating back using bfcache #134

Open WebFreak001 opened 3 years ago

WebFreak001 commented 3 years ago

When navigating in the browser using the back/forwards buttons the browser caches the entire page and JS state (bfcache), so unread/read states of threads are not refreshed when navigating back.

This causes threads to stay bold, even when you just read them and navigated back using the browser's back button.

You can use bfcache events to check when such a navigation occurs and store the thread you clicked on when leaving and on going back on the page make it render as read. Alternatively it would also be possible to perform an XHR when loading the page again, but I think that might be overkill (and should probably reload all the data)

Possible issue with the simple read marker: when there is more than a page of posts and you didn't read all of the posts, you would need to show just that there are less posts to read instead of no posts to read. It would be possible to track this through the sessionStore to see how far you went though.

CyberShadow commented 3 years ago

I feel like this is handled sufficiently well by there being two mechanisms (client-side and server-side) to track read state. The client-side mechanism is visited links, which are styled slightly differently.