Skip to content

Factor logic of what screens to display when out of MatrixChat #28121

@dbkr

Description

@dbkr

Your use case

In writing element-hq/matrix-react-sdk#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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions