element-hq / element-hq/element-web

Factor logic of what screens to display when out of MatrixChat

Open
#28,121 0 comments 0 reactions 0 assignees View on GitHub
A-Developer-Experience T-Task
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Your use case

In writing https://github.com/element-hq/matrix-react-sdk/pull/44 I changed MatrixChat to display the Complete Security screen after login under certain conditions and it caused everything to break horribly. There are so many screens that MatrixChat might show at different points under different conditions. Fortunately a good amount of them are covered by tests. Most of them are playwright but some are "unit" tests on MatrixChat (which are more integration tests because they essentially cause the whole app to be started).

It would be better to have a separate store class that decided what screen should be shown when, and decide it in one place. The current logic looks, I believe, something like this (albeit incomplete):

```
matrixchat startInitSession
matrixchat initSession -> might show some screens once done
matrixchat loadSession -> might show some screens once done
Lifecycle.loadSession();
lifecycle restoreSessionFromStorage
lifecycle doSetLoggedIn
------- OnLoggedIn fires here
lifecycle startMatrixClient
MatrixClientPeg.start
MatrixClientPeg.assign
MatrixClientPeg.initClientCrypto
DOES MIGRATIONS
-------- login splash view needs to be shown BEFORE this point
-------- we now know whether we want to show complete security
starts syncing
push rules fetched
-------- now safe to show first time user flow
start syncing
- waits for get versions but not first/cached sync (I think)
prepared
syncing
```

### Have you considered any alternatives?

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.