Topic timeline is affected by non-default suggested topics value

Putting this in #bug as I feel this is preventing the normal use of Discourse, but it may be a better fit for #ux.

I started noticing on one of my sites (internal, so I can’t share a link) that the topic timeline was a bit wonky, and started playing around to try and figure out what was going on. Essentially when using the topic timeline to go to a recent post (like 5 or 6 out of 6) the posts would not scroll as expected, and the post that I scrolled to would not actually be visible. I couldn’t reproduce this on Meta or Stonehearth, nor in my development environment, so I started looking into what was different between the sites. I eventually realized that my site has suggested topics “disabled” (suggested topics = 0), while Meta, Stonehearth, and dev do not. After disabling suggested topics on dev I could reproduce the issue.

@eviltrout, does the topic timeline scrolling assume that there are suggested topics?

Videos of the issue:

Default - 5 suggested topics:

0 suggested topics:

20 suggested topics:

3 Likes

It very well could be a bug! I’ll look into it.

6 Likes

This should fix it:

https://github.com/discourse/discourse/commit/4e1f8ec72b791006fca7c6c3347c8347d27e4dc6

5 Likes

I’m re-opening this for now. Unfortunately my fix broke scrolling on meta a bit so I reverted it. I’ll have to come up with a more robust solution.

1 Like

Okay, I think this fixes it for good. This is surprisingly complicated stuff to get right.

@jomaxro could you confirm it’s working for you?

https://github.com/discourse/discourse/commit/cb8f91ca215a5dc85a771b3691b334a89c54664a

4 Likes

Happy to test once this reaches tests_passed!

1 Like

I hate to say this, but it’s “mostly” working. Just tested in the two topics I shared with you via PM. They both load correctly now (showing the last post) and using the timeline to go from a post to the last one work, but the timeline itself is very finicky.

Entering a fully read topic results in the browser being scrolled fully, but the timeline is not.

Also, moving via the timeline is incredibly jumpy. In topic 8022, moving the timeline to post 4 results in the timeline jumping to post 2 upon release. Post 3 also jumps to post 2. Post 5 jumps to post 6…etc.

Happy to change the password back if you’d like…

I would rather force everyone to use suggested topics rather than spend days of engineering effort on this unusual non-default settings scenario.

That said there are other places where suggested may not be there, such as PMs.