diff --git a/lib/features/base/base_mailbox_controller.dart b/lib/features/base/base_mailbox_controller.dart index 67a1d9227..4883fd759 100644 --- a/lib/features/base/base_mailbox_controller.dart +++ b/lib/features/base/base_mailbox_controller.dart @@ -18,7 +18,7 @@ abstract class BaseMailboxController extends BaseController { final folderMailboxTree = MailboxTree(MailboxNode.root()).obs; final defaultMailboxTree = MailboxTree(MailboxNode.root()).obs; - void buildTree(List allMailbox) async { + Future buildTree(List allMailbox) async { final tupleTree = await _treeBuilder.generateMailboxTreeInUI(allMailbox); defaultMailboxTree.value = tupleTree.value1; folderMailboxTree.value = tupleTree.value2; diff --git a/lib/features/mailbox/presentation/mailbox_controller.dart b/lib/features/mailbox/presentation/mailbox_controller.dart index 46eeb415d..5b9d14f49 100644 --- a/lib/features/mailbox/presentation/mailbox_controller.dart +++ b/lib/features/mailbox/presentation/mailbox_controller.dart @@ -136,11 +136,11 @@ class MailboxController extends BaseMailboxController { @override void onData(Either newState) { super.onData(newState); - newState.map((success) { + newState.map((success) async { if (success is GetAllMailboxSuccess) { allMailboxes = success.mailboxList; currentMailboxState = success.currentMailboxState; - buildTree(allMailboxes); + await buildTree(allMailboxes); _setUpMapMailboxIdDefault(allMailboxes, defaultMailboxTree.value, folderMailboxTree.value); }