FIX: Ensure tag topic lists are not scrolled to an incorrect position (#12805)

When navigating from a 'discovery' topic list to a 'tags' topic list, the scroll position from the 'discovery' list was being used by the tag list. That meant the user would be taken to a random point in the list, and not scrolled to the top.

Non-tag topic lists were working fine because we only apply the 'cached' logic (and by extension, the saved scroll location) when the user clicks 'back' in the browser. In the code, this is referred to as `isPoppedState`.

This commit takes the `isPoppedState` logic from the regular topic lists, and applies it to the tag topic lists.
This commit is contained in:
David Taylor 2021-04-22 22:09:20 +01:00 committed by GitHub
parent 984d87f30c
commit 890b06b10f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,7 +95,7 @@ export default DiscourseRoute.extend(FilterModeMixin, {
}
return findTopicList(this.store, this.topicTrackingState, filter, params, {
cached: true,
cached: this.isPoppedState(transition),
}).then((list) => {
if (list.topic_list.tags && list.topic_list.tags.length === 1) {
// Update name of tag (case might be different)