From 7183d9193033b028767187d138f425cc5010bb10 Mon Sep 17 00:00:00 2001 From: David Langley Date: Fri, 21 Nov 2025 17:04:52 +0000 Subject: [PATCH] Improve viewSomethingBehindModal logic (#31301) --- src/components/structures/MatrixChat.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 51c5dbeb3f..b734dc9138 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -632,6 +632,10 @@ export default class MatrixChat extends React.PureComponent { ); } + private isLoggedInViewPageDisplayed(): boolean { + return this.loggedInView.current !== null && this.state.page_type !== undefined; + } + private setStateForNewView(state: Partial): void { if (state.view === undefined) { throw new Error("setStateForNewView with no view!"); @@ -1097,7 +1101,8 @@ export default class MatrixChat extends React.PureComponent { this.viewWelcome(); return; } - if (!this.state.currentRoomId && !this.state.currentUserId) { + + if (!this.state.currentRoomId && !this.state.currentUserId && !this.isLoggedInViewPageDisplayed()) { this.viewHome(); } } @@ -1852,7 +1857,7 @@ export default class MatrixChat extends React.PureComponent { // if we weren't already coming at this from an existing screen // and we're logged in, then explicitly default to home. // if we're not logged in, then the login flow will do the right thing. - if (!this.state.currentRoomId && !this.state.currentUserId) { + if (!this.state.currentRoomId && !this.state.currentUserId && !this.isLoggedInViewPageDisplayed()) { this.viewHome(); } } else if (screen === "settings") {