Back button history not properly working

Just the last two days I’ve seen this behavior:

  • browsed to topic from latest
  • read for a moment then go back to latest
  • browsed to another topic
  • hit back and it takes me to the first topic I browsed to instead of latest

I’ve seen this behavior on Safari for iOS (technically iPadOS public beta 1) and Firefox for Mac.

I don’t think this worked this way previous to two days ago but I could be wrong.

1 Like

I just tried and it doesn’t seem to work for me. Is it 100% every time for you, or only sometimes?

1 Like

I have been seeing this for the last couple days as well, but I can’t nail don’t the reproduction steps - I thought I was just seeing things to start :slight_smile:

1 Like

There is likely some kind of link that our new history API fixes haven’t accounted for. If someone can help us isolate it we would be eternally grateful!

3 Likes

Is that only happening on the beta? Because we don’t support beta OSes.

1 Like

I have it happening on MacOS 10.14.5, and up-to-date Chrome

3 Likes

I have been playing with it for a bit here - I can’t give you exact steps, but I can trigger it 1 time in 5 (or more) by just picking a random topic, opening it, scrolling around, hitting back, then picking another random topic, opening it, scrolling around and hitting back again. Fairly often it will go back to the first topic, rather than the topic list.

Not a great repro case, but definitely hitting it a lot this way. Definitely no errors in the console when it happens.

edit: When it occurs, you can watch the URL when you hit back, it starts at meta.discourse.org/ and almost immediately after the list loads it re-writes the URL to the URL of the post you were just on

edit 2: I can actually trigger it almost constantly by clicking into this topic, scrolling up, then immediately clicking back (I have a back button mapped on my mouse - maybe that is why I can trigger it easily) - definitely looks like a timing issue for some return value.

edit 3: constant reproduction - click any topic, before it loads fully click back - URL re-writes after topic list loads to the URL of the post you just left

3 Likes

Aha, so it’s loading speed related. Thanks that is helpful.

3 Likes

This should do it:

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

I was surprised to find this did not have to do with recent changes to the history, but was in fact caused by a new willTransition added in a recently merged commit.

I guess we should always remember to return true in willTransition methods!

10 Likes

This topic was automatically closed after 26 hours. New replies are no longer allowed.