mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Avoid database access on the main thread when opening the settings
`getUserProfile()` was storing the user profile (DB read, avatar Base64 encoding, DB write) on the caller dispatcher, i.e. the main thread when called from a presenter, causing glitches in the screen transition. - Run the whole `getUserProfile()` on the session dispatcher. - Make `DatabaseSessionStore` main-safe by running the queries on the IO dispatcher. - Do not refresh the profile twice from the settings screen. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-4
@@ -40,10 +40,7 @@ class PreferencesAccountPresenter(
|
||||
@Composable
|
||||
override fun present(): PreferencesAccountState {
|
||||
val matrixUser = matrixClient.userProfile.collectAsState()
|
||||
LaunchedEffect(Unit) {
|
||||
// Force a refresh of the profile
|
||||
matrixClient.getUserProfile()
|
||||
}
|
||||
// Note: no need to force a refresh of the profile here, PreferencesRootPresenter, which embeds this presenter, already does it.
|
||||
val showLinkNewDevice by remember {
|
||||
featureFlagService.isFeatureEnabledFlow(FeatureFlags.QrCodeLogin)
|
||||
}.collectAsState(initial = false)
|
||||
|
||||
Reference in New Issue
Block a user