Back button causing invalid lists


(Sam Saffron) #1
  1. In browser (1) go to the new tab, click on a topic
  2. In browser (2) under account (2) create a new topic
  3. In browser (1) hit back

You get:

What should happen?

Option (1) … don’t bother loading from cache if less than N topics - not a full solution but may help

Option (2) … If cache has a mismatching count of what we think (new) or (unread) is, junk it.

Option (3) …
When we hit back we can load from cache, but… we must also trigger a refresh. The refresh should update the list and sync the counts.

This would be of huge use, avatars will be fixed up, and counts will all appear correct.


The above are all just ideas, I think option (3) is probably the most robust

cc @eviltrout


New topics get unread counts after using back button
(Robin Ward) #3

I looked into this and (3) would not work for maintaining the scroll position. If we re-sync and then add more topics at the top it would jump the scroll position. Unless of course there was special logic to not insert topics when scrolled or something.

I decided to go with a variant of (1) – if the cache is less than one page’s worth of topics we don’t bother with it. The main use for the cache at this point is for scrolling and hitting back;

So the number can be wrong when you have multiple pages of topics. However, at that point I’d argue the user is much less likely to notice as they are probably scrolled down, and who is going to count 60+ topics to notice?

https://github.com/discourse/discourse/commit/5dea3720a437a9c4392584b8c6796b6c47b8ffda


(Robin Ward) #4