Improve viewSomethingBehindModal logic (#31301)

This commit is contained in:
David Langley
2025-11-21 17:04:52 +00:00
committed by GitHub
parent cdedcc0b5a
commit 7183d91930
+7 -2
View File
@@ -632,6 +632,10 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
); );
} }
private isLoggedInViewPageDisplayed(): boolean {
return this.loggedInView.current !== null && this.state.page_type !== undefined;
}
private setStateForNewView(state: Partial<IState>): void { private setStateForNewView(state: Partial<IState>): void {
if (state.view === undefined) { if (state.view === undefined) {
throw new Error("setStateForNewView with no view!"); throw new Error("setStateForNewView with no view!");
@@ -1097,7 +1101,8 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
this.viewWelcome(); this.viewWelcome();
return; return;
} }
if (!this.state.currentRoomId && !this.state.currentUserId) {
if (!this.state.currentRoomId && !this.state.currentUserId && !this.isLoggedInViewPageDisplayed()) {
this.viewHome(); this.viewHome();
} }
} }
@@ -1852,7 +1857,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
// if we weren't already coming at this from an existing screen // if we weren't already coming at this from an existing screen
// and we're logged in, then explicitly default to home. // 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 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(); this.viewHome();
} }
} else if (screen === "settings") { } else if (screen === "settings") {