From 16da727de5b9b4cb04ef52c4418866d95f287a8d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Jun 2023 12:02:58 +0100 Subject: [PATCH] Clear thread panel event permalink when changing rooms To not get you stuck being constantly bounced to the middle of a thread --- src/stores/right-panel/RightPanelStore.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stores/right-panel/RightPanelStore.ts b/src/stores/right-panel/RightPanelStore.ts index e3e0183d406..733550ee3d0 100644 --- a/src/stores/right-panel/RightPanelStore.ts +++ b/src/stores/right-panel/RightPanelStore.ts @@ -366,6 +366,13 @@ export default class RightPanelStore extends ReadyWatchingStore { ); } } + // when we're switching to a room, clear out thread permalinks to not get you stuck in the middle of the thread + // in order to fix https://github.com/matrix-org/matrix-react-sdk/pull/11011 + if (this.currentCard?.phase === RightPanelPhases.ThreadView) { + this.currentCard.state.initialEvent = undefined; + this.currentCard.state.isInitialEventHighlighted = undefined; + this.currentCard.state.initialEventScrollIntoView = undefined; + } // If the right panel stays open mode is used, and the panel was either // closed or never shown for that room, then force it open and display