Update state of topics when opening in new tab


(Barry van Oudtshoorn) #1

I’m one of those people who queues up a whole lot of tabs for reading, and then reads them. When I do this in Discourse, the various attributes of posts aren’t updated when I open the new tab – the visited state, the new state, the number of unread messages, and so on. This is both on the page where the topics were listed, and at the bottom of each post.

I understand that this is technically a hard thing to do, because up until recently, each tab loading would mean the server would have to send a message back to each other tab requesting an update. And this could result in uncomfortable “jumps” as the “suggested topics” gets reloaded or refreshed.

I wonder, though, whether the new BroadcastChannel API (available from Chrome 54, Firefox 38, and Opera 41), coupled with a change to the way this would work, would help. What I’m envisaging is that the changes become purely client-side cosmetic changes. In other words, when I open a topic in a new tab, all the other tabs update its status – but don’t force a reload of things like the “Suggested topics” area. Yes, this could (and will) result in some open topics’ “suggested topics” containing only now-read items – but, speaking from personal experience, this area generally wouldn’t be much used by people who are very tab-happy.

The advantages of this approach are that there’s no increase in server load (I understand that retrieving suggested topics can be one of the slowest queries to run), there’s no uncomfortable “bump” or “jerkiness” as content is swapped out with differently-sized content, tab-happy users get more consistent visibility of state, and it’s (maybe?) relatively simple to implement.

I’m not sure, though, how many tab-happy people like me there are out there who use Discourse in the same way I do – is this a problem that other people have run into? I did do some searching but couldn’t find very much explicitly on this topic, but I do recall some tangential comments about this in other topics.


(Mittineague) #2

I’m wondering how these proposed changes would fit into your work flow.

It seems to me if I was “tab happy” I would finish reading a tabs content and then move on to the next tab.

That is, I wold not be likely to be clicking on any Suggested topics, updated or otherwise, until I was back to having only a single tab for the forum open.


(Barry van Oudtshoorn) #3

The key is really about updating the page that I started from. I’ll open up, say, the “Latest” page, and then open up half-a-dozen or so tabs from that page. Once I’ve read them, I’ll close them all and continue on down the list of topics on the “Latest” page. This sort of model works well when browsing, say, Hacker News, as the links get the :visited state due to browser behaviour. On Discourse, however, visited-ness is tracked by Discourse itself, so that it can better manage across multiple devices (which I love!), so when I come back to the “root” page, it can take a little while to work out where I was or what I did or didn’t open.