Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
private readonly stores: SdkContextClass;
private loadSessionAbortController = new AbortController();

private sessionLoadStarted = false;

public constructor(props: IProps) {
super(props);
this.stores = SdkContextClass.instance;
Expand Down Expand Up @@ -470,15 +472,22 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
this.fontWatcher.start();

initSentry(SdkConfig.get("sentry"));
window.addEventListener("resize", this.onWindowResized);

// Once we start loading the MatrixClient, we can't stop, even if MatrixChat gets unmounted (as it does
// in React's Strict Mode). So, if this MatrixChat was previously mounted, bail out before we start loading
// the session.
if (this.sessionLoadStarted) {
return;
}

this.sessionLoadStarted = true;
if (!checkSessionLockFree()) {
// another instance holds the lock; confirm its theft before proceeding
setTimeout(() => this.setState({ view: Views.CONFIRM_LOCK_THEFT }), 0);
} else {
this.startInitSession();
}

window.addEventListener("resize", this.onWindowResized);
}

public componentDidUpdate(prevProps: IProps, prevState: IState): void {
Expand Down
Loading