Skip to content

Commit

Permalink
Fix Settings/AllMedia in Account List context menu
Browse files Browse the repository at this point in the history
- combine all settings-gathering when changing account since some
  functions await for SelectAccount
- give additional 50ms to switching to Gallery since there's a conflict
  of setState and async media query in Gallery.tsx
- resolves #4190
- resolves #4191
  • Loading branch information
maxphilippov committed Oct 8, 2024
1 parent fb05580 commit 0a62166
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 9 additions & 7 deletions packages/frontend/src/ScreenController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,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)
})
return Promise.all([
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)
}),
])
}

async unSelectAccount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
},
{
Expand Down

0 comments on commit 0a62166

Please sign in to comment.