From b246a63a5922321eb63d28a191a0cde3f1152f21 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 10 Sep 2021 12:36:01 -0400 Subject: [PATCH] FIX: Give the topic timeline unique keys for state We've observed an error where the back button is displayed improperly in the topic timeline. It's unfortunately been hard to reproduce but we suspect it's related to leftover state when re-rendering. This fix optimistically tries to fix the error by introducing the topic's id to the unique key the widgets use for state. We can deploy this and keep an eye out for the bug in the future. --- .../javascripts/discourse/app/widgets/topic-timeline.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/widgets/topic-timeline.js b/app/assets/javascripts/discourse/app/widgets/topic-timeline.js index 03149812e00..85b088ff4bd 100644 --- a/app/assets/javascripts/discourse/app/widgets/topic-timeline.js +++ b/app/assets/javascripts/discourse/app/widgets/topic-timeline.js @@ -144,7 +144,7 @@ createWidget("timeline-padding", { createWidget("timeline-scrollarea", { tagName: "div.timeline-scrollarea", - buildKey: () => `timeline-scrollarea`, + buildKey: (attrs) => `timeline-scrollarea-${attrs.topic.id}`, buildAttributes() { return { style: `height: ${scrollareaHeight()}px` }; @@ -411,7 +411,7 @@ createWidget("timeline-footer-controls", { export default createWidget("topic-timeline", { tagName: "div.topic-timeline", - buildKey: () => "topic-timeline-area", + buildKey: (attrs) => `topic-timeline-area-${attrs.topic.id}`, defaultState() { return { position: null, excerpt: null };