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.
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.
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.
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.