From e18860f1e8e4ae2bb502056fbf591c827c0a8a70 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Fri, 23 Oct 2026 14:19:37 -0700 Subject: [PATCH] fix(dashboard): leave the temporary-account state once the account is saved Saving a temporary account from the user menu promoted the user in place without a reload, but Home kept its Save session warning (reopening the save dialog for a saved account) and Account and Security stayed without their password and email cards until the page was reloaded. The dashboard now reacts to account-saved, which fires after the user is updated. --- src/gui/src/UI/Dashboard/UIDashboard.js | 12 ++++++++++++ src/gui/src/UI/UIWindowSaveAccount.js | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gui/src/UI/Dashboard/UIDashboard.js b/src/gui/src/UI/Dashboard/UIDashboard.js index 16e4b1572..5ef23e5f8 100644 --- a/src/gui/src/UI/Dashboard/UIDashboard.js +++ b/src/gui/src/UI/Dashboard/UIDashboard.js @@ -228,6 +228,18 @@ async function UIDashboard (options) { } } + // Saving a temporary account promotes this session's user in place: the + // save prompt goes, and the tabs that leave out cards for a temporary + // user (password, email) render again. + window.addEventListener('account-saved', () => { + $el_window.find('.bento-save-account-warning').remove(); + for ( const tab of tabs ) { + if ( tab.id !== 'account' && tab.id !== 'security' ) continue; + $el_window.find(`.dashboard-section-${tab.id}`).html(tab.html()); + tab.init?.($el_window); + } + }); + // Dispatch 'dashboard-ready' event for extensions window.dispatchEvent(new CustomEvent('dashboard-ready', { detail: { window: $el_window } })); diff --git a/src/gui/src/UI/UIWindowSaveAccount.js b/src/gui/src/UI/UIWindowSaveAccount.js index dfbc353dc..91ea56ad8 100644 --- a/src/gui/src/UI/UIWindowSaveAccount.js +++ b/src/gui/src/UI/UIWindowSaveAccount.js @@ -156,11 +156,11 @@ async function UIWindowSaveAccount (options) { 'Authorization': `Bearer ${window.auth_token}`, }, success: async function (data) { - window.dispatchEvent(new CustomEvent('account-saved', { detail: { data: data } })); - // /save_account promotes the current session's user in place // and does not rotate the token, so keep the one we have. await window.update_auth_data(data.token ?? window.auth_token, data.user); + // After the update, so listeners read the saved user. + window.dispatchEvent(new CustomEvent('account-saved', { detail: { data: data } })); //close this window if ( data.user.requires_email_confirmation && !data.user.email_confirmed ) {