diff --git a/CHANGELOG.md b/CHANGELOG.md index 0764324646..1bcf54774f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,8 @@ - fix: exit search when clicking on profile when the selected profile is already the selected account #4166 - "Encryption Info" dialog showing all info in one line #4162 - losing scrolling "momentum" while scrolling the messages list fast #4122 +- fix crash when you chose Settings from a context menu on account you haven't selected #4190 +- fix All Media not opening from a context menu on account you haven't selected #4191 diff --git a/packages/frontend/src/ScreenController.tsx b/packages/frontend/src/ScreenController.tsx index 0e44164a2d..d6005aca98 100644 --- a/packages/frontend/src/ScreenController.tsx +++ b/packages/frontend/src/ScreenController.tsx @@ -121,6 +121,9 @@ export default class ScreenController extends Component { await this.unSelectAccount() this.selectedAccountId = accountId ;(window.__selectedAccountId as number) = accountId + // forcing to load settings here so when we for example switch to Settings + // from context menu they're already present and we avoid crashing + SettingsStoreInstance.effect.load() } else { log.info('account is already selected') // do not return here as this can be the state transition between unconfigured to configured @@ -138,13 +141,15 @@ export default class ScreenController extends Component { if (!dontStartIo) { await BackendRemote.rpc.startIo(accountId) } - runtime.setDesktopSetting('lastAccount', accountId) - BackendRemote.rpc.getSystemInfo().then(info => { - log.info('system_info', info) - }) + BackendRemote.rpc.getInfo(accountId).then(info => { log.info('account_info', info) }) + BackendRemote.rpc.getSystemInfo().then(info => { + log.info('system_info', info) + }) + + await runtime.setDesktopSetting('lastAccount', accountId) } async unSelectAccount() { diff --git a/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx b/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx index b9578c1094..53cb6274b9 100644 --- a/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx +++ b/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx @@ -99,7 +99,9 @@ export default function AccountItem({ // set Timeout forces it to be run after react update setTimeout(() => { ActionEmitter.emitAction(KeybindAction.GlobalGallery_Open) - }, 0) + // NOTE(maxph): Gallery.tsx gets unmounted before receiving media data + // and breaks markdown, so here 50ms is a temprorary workaround for that + }, 50) }, }, { diff --git a/packages/frontend/src/stores/settings.ts b/packages/frontend/src/stores/settings.ts index 7217f8ea4a..3032536db3 100644 --- a/packages/frontend/src/stores/settings.ts +++ b/packages/frontend/src/stores/settings.ts @@ -133,7 +133,7 @@ class SettingsStore extends Store { ) const desktopSettings = await runtime.getDesktopSettings() - const rc = await runtime.getRC_Config() + const rc = runtime.getRC_Config() this.reducer.setState({ settings, selfContact,