Use cached message store when re-opening dirs

This commit is contained in:
Drew DeVault 2019-03-14 22:41:43 -04:00
parent 62946ff6c5
commit 4ec7f5dea5
1 changed files with 9 additions and 1 deletions

View File

@ -177,7 +177,15 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
case *types.Done:
switch msg.InResponseTo().(type) {
case *types.OpenDirectory:
acct.msglist.SetStore(nil)
if store, ok := acct.msgStores[acct.dirlist.selected]; ok {
// If we've opened this dir before, we can re-render it from
// memory while we wait for the update and the UI feels
// snappier. If not, we'll unset the store and show the spinner
// while we download the UID list.
acct.msglist.SetStore(store)
} else {
acct.msglist.SetStore(nil)
}
acct.worker.PostAction(&types.FetchDirectoryContents{},
func(msg types.WorkerMessage) {
store := acct.msgStores[acct.dirlist.selected]