On safari we need to start database before rehydration like on other browsers. This is done by initializing the database in getDatabaseModule, so as soon as it's called somewhere we make sure the database is ready to go. This diff also merges initForDBForLoggedInUser, init, and constructor because there was some code duplication.
Test in safari and in chromium:
- check if there's "Database initialization success" when logging in and when reloading when logged in
- check if clearSensitiveData is called after logging out
- check if draft are still there after reload (drafts are persisted with db operations)
- check if selected apps are still there after reload (selected apps are persisted with standard redux persist mechanism)
Fixed window.status -> this.status issue
|38 ↗||(On Diff #30911)|
Flow didn't complain because (flow docs): "However, Flow will not enforce that all class properties are initialized in constructors"
Actually all of these fields should be set to possibly undefined if we want to be correct, but that would add some invariants/if checks.
I have a solution that is typed correctly and without invariants, but not sure if it's worth it as it's a bit more complex.