From 5e3fc3801f68e35d29c4547f478a576477a85c0a Mon Sep 17 00:00:00 2001 From: jrburke Date: Wed, 2 Mar 2016 11:39:28 -0800 Subject: [PATCH] Finish initialization when there are no accounts configured --- www/app/actions/viewing.js | 2 +- www/app/reducers/viewing.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/www/app/actions/viewing.js b/www/app/actions/viewing.js index 352a105..c798a0d 100644 --- a/www/app/actions/viewing.js +++ b/www/app/actions/viewing.js @@ -37,7 +37,7 @@ return { const account = mailApi.accounts.defaultAccount; return { type: SELECT_ACCOUNT, - accountId: account.id, + accountId: (account && account.id || null), folderType: 'inbox' }; }, diff --git a/www/app/reducers/viewing.js b/www/app/reducers/viewing.js index 2048f01..b960035 100644 --- a/www/app/reducers/viewing.js +++ b/www/app/reducers/viewing.js @@ -209,11 +209,17 @@ return function reduceViewing(oldState = DEFAULT_STATE, action) { let dirtySerials = false; switch (action.type) { case SELECT_ACCOUNT: { - let account = mailApi.accounts.getAccountById(action.accountId); - let folder = account.folders.getFirstFolderWithType(action.folderType); + let account = action.accountId ? + mailApi.accounts.getAccountById(action.accountId) : + null; + + let folder = action.accountId ? + account.folders.getFirstFolderWithType(action.folderType) : + null; + newState.selections = { - accountId: account.id, - folderId: folder.id, + accountId: (account && account.id) || null, + folderId: (folder && folder.id) || null, conversationId: null, messageId: null };