From 026e8a17ca40955652949584388b38566fef66e7 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 13 May 2019 20:16:55 -0400 Subject: Handle incoming emails gracefully --- widgets/account.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'widgets/account.go') diff --git a/widgets/account.go b/widgets/account.go index c01b15f..ba2b8d3 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -161,17 +161,17 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { } else { acct.msglist.SetStore(nil) } - acct.worker.PostAction(&types.FetchDirectoryContents{}, - func(msg types.WorkerMessage) { - store := acct.msgStores[acct.dirlist.selected] - acct.msglist.SetStore(store) - }) } case *types.DirectoryInfo: if store, ok := acct.msgStores[msg.Name]; ok { store.Update(msg) } else { - acct.msgStores[msg.Name] = lib.NewMessageStore(acct.worker, msg) + store = lib.NewMessageStore(acct.worker, msg) + acct.msgStores[msg.Name] = store + store.OnUpdate(func(_ *lib.MessageStore) { + store.OnUpdate(nil) + acct.msglist.SetStore(store) + }) } case *types.DirectoryContents: store := acct.msgStores[acct.dirlist.selected] -- cgit v1.2.3