TOC missing after using browsers back button

Steps to reproduce

  1. Open a topic with a toc (for example: Understanding user statuses, roles, and permissions)
  2. Navigate to a different topic using related topics or a link from your notifications menu
  3. Use the back button to get back to the first topic
  4. Now the toc does not show
    Missing TOC
3 Likes

I can repro it.

Weirdly, it doesn’t happen if we click a topic from the linked topics:
image

In another discourse forum, I observed the exact opposite. I visited a topic with toc from a pn and upon returning, I suddenly found myself back next to the 30th personal message, but with an empty toc instead of the navigation. Since that forum doesn’t use the most recent version I tried here but I was unable to replicate this issue. So maybe that is already fixed.

1 Like

I just merged a fix into Discourse core which should resolve this issue. It should be live on Meta within an hour.

The bug depends on your scroll position in both the source and destination topic, so that might explain why it feels inconsistent to reproduce. If you were scrolled to the first post on both the source and destination topic, then the DiscoTOC display logic would be broken.

8 Likes

Nice catch. I’ve been using the TOC quite a bit lately with a couple of longer documents in particular and haven’t seen that behavior, but I was just able to reproduce it now based on what @Moin and @david said.

2 Likes

Works great.

But now I can reproduce the other bug.
When you navigate from a topic with a toc to one without the navigation does not appear.
It works the same. The only difference is, that you don’t use the back button of the browser.
Missing Navigation
In mobile mode you can see the toc is the issue
Toc too much

2 Likes

I think this issue is likely resolved by the DiscoTOC overhaul @awesomerobot has recently merged. Would you mind confirming @Moin?

3 Likes

I did not notice any missing tocs or missing timelines anymore here at meta

3 Likes