mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 10:15:27 -04:00
Email library: await _loadAccounts before loading emails
After dropping the 'Default' chip, _loadAccounts started setting state._libAccountId asynchronously while _loadEmails fired in parallel with the still-null id. The list request was going out with no account_id (so the server defaulted) while subsequent per-email reads used the explicit id set after _loadAccounts resolved — back to the same desync the chip-removal was meant to fix. Sequence them: await _loadAccounts first, then kick off the folders / reminders / emails fetches. The list always carries the right account_id from the very first call.
This commit is contained in:
@@ -1321,10 +1321,15 @@ export function openEmailLibrary(opts = {}) {
|
|||||||
document.addEventListener('keydown', state._libEscHandler, true);
|
document.addEventListener('keydown', state._libEscHandler, true);
|
||||||
|
|
||||||
_renderAccountsLoading();
|
_renderAccountsLoading();
|
||||||
_loadAccounts();
|
// Await accounts before loading emails so the list request carries the
|
||||||
_loadFolders();
|
// right account_id from the very first fetch (now that we auto-select
|
||||||
_loadEmailReminderBellVisibility();
|
// an explicit account instead of relying on a 'Default' chip).
|
||||||
_loadEmails();
|
(async () => {
|
||||||
|
await _loadAccounts();
|
||||||
|
_loadFolders();
|
||||||
|
_loadEmailReminderBellVisibility();
|
||||||
|
_loadEmails();
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _loadAccounts() {
|
async function _loadAccounts() {
|
||||||
|
|||||||
Reference in New Issue
Block a user