Pre-Flight checklist
Describe The Feature Request Below
Nearly every lemmy API action which requires an account, is currently surrounded by:
account.doIfReadyElseDisplayInfo(
appState,
ctx,
resources,
snackbarHostState,
scope,
myUserInfoViewModel, (previously SiteViewModel)
accountViewModel,
) {
- This account verification does a lot of altering and refetching of both the accountViewModel, and the Site/MyUserInfoViewModel, which is dangerous for screens which should not be changing accounts or resetting account info.
- Its cumbersome because now every screen requires many viewModels, which they should really only be reading.
Some recommendations:
- These checks should not really be done just to display or not display buttons, but should only be run on startup or account change.
- Buttons should use
myUserInfo != null to determine whether to enable or disable buttons, or hide them entirely. This simple check is how lemmy-ui handles all login-related items.
- The
AccountViewModel should probably take in the myUserInfoViewModel and siteViewModels as props, so that it can set them directly when switching accounts, rather than those viewmodels each using flows to watch the accountViewModel.
- It might be necessary to create a dedicated
Logging In / Verifying screen, so that when switching accounts from the sidebar, the current screen doesn't need to take in and alter all these viewModels.
Pre-Flight checklist
Describe The Feature Request Below
Nearly every lemmy API action which requires an account, is currently surrounded by:
account.doIfReadyElseDisplayInfo( appState, ctx, resources, snackbarHostState, scope, myUserInfoViewModel, (previously SiteViewModel) accountViewModel, ) {Some recommendations:
myUserInfo != nullto determine whether to enable or disable buttons, or hide them entirely. This simple check is how lemmy-ui handles all login-related items.AccountViewModelshould probably take in themyUserInfoViewModelandsiteViewModelsas props, so that it can set them directly when switching accounts, rather than those viewmodels each using flows to watch the accountViewModel.Logging In/Verifyingscreen, so that when switching accounts from the sidebar, the current screen doesn't need to take in and alter all these viewModels.