Skip to content

Conversation

@richvdh
Copy link
Member

@richvdh richvdh commented Aug 28, 2025

When running in development mode, MatrixChat.componentDidMount is run twice,
meaning it checks the session lock twice. Sometimes, this means it shows the
"Element is running in another window" page.

The real problem is of course that we're running all this application logic
inside the MatrixChat component, but as a quick workaround, we can just
remember that we've started the session load code, and bail out on the second pass.

When running in development mode, `MatrixChat.componentDidMount` is run twice,
meaning it checks the session lock twice. Sometimes, this means it shows the
"Element is running in another window" page.

The real problem is of course that we're running all this application logic
inside the `MatrixChat` component, but as a quick workaround, we can just
remember that we've started the session load code, and bail out on the second pass.
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being in the c'tor is a bit of a foot-gun, one wouldn't expect a c'tor to bail early and they may add code at the end, such as the resize listener was and end up suffering

Can you break it out into a private method at least

Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being in the c'tor is a bit of a foot-gun, one wouldn't expect a c'tor to bail early and they may add code at the end, such as the resize listener was and end up suffering

Can you break it out into a private method at least

@t3chguy
Copy link
Member

t3chguy commented Aug 28, 2025

or invert the condition and move the relevant code into the if

edit:

the diff was confusing, not the c'tor, componentDidMount, but same footgun statement applies

@richvdh
Copy link
Member Author

richvdh commented Aug 28, 2025

or invert the condition and move the relevant code into the if

done

@richvdh richvdh requested a review from t3chguy August 28, 2025 15:22
@richvdh richvdh enabled auto-merge August 28, 2025 15:34
@richvdh richvdh added this pull request to the merge queue Aug 28, 2025
Merged via the queue into develop with commit 7010190 Aug 28, 2025
37 checks passed
@richvdh richvdh deleted the rav/session_load_once branch August 28, 2025 16:27
Dileep9999 pushed a commit to hemanth-nag/element-web that referenced this pull request Oct 8, 2025
* MatrixChat: only start session load once

When running in development mode, `MatrixChat.componentDidMount` is run twice,
meaning it checks the session lock twice. Sometimes, this means it shows the
"Element is running in another window" page.

The real problem is of course that we're running all this application logic
inside the `MatrixChat` component, but as a quick workaround, we can just
remember that we've started the session load code, and bail out on the second pass.

* Address review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Task Tasks for the team like planning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants