fix: keep profile placeholder refresh in switch path

This commit is contained in:
starship-s
2026-05-01 00:27:27 -06:00
parent 5c7c4c28e3
commit 8439817c76
+4 -3
View File
@@ -2233,6 +2233,10 @@ async function switchToProfile(name) {
const data = await api('/api/profile/switch', { method: 'POST', body: JSON.stringify({ name }) });
S.activeProfile = data.active || name;
// Update composer placeholder and title bar while the core profile-switch
// state is still close to the profile API response.
if (typeof applyBotName === 'function') applyBotName();
// ── Model + Workspace (parallelized) ───────────────────────────────────
// populateModelDropdown hits /api/models; loadWorkspaceList hits /api/workspaces.
// They are fully independent — run both simultaneously to cut switch time ~50%.
@@ -2323,9 +2327,6 @@ async function switchToProfile(name) {
if (_currentPanel === 'profiles') await loadProfilesPanel();
if (_currentPanel === 'workspaces') await loadWorkspacesPanel();
// Update composer placeholder and title bar to reflect profile name
if (typeof applyBotName === 'function') applyBotName();
} catch (e) {
// Revert the optimistic name update on error
if (_chipLabel) _chipLabel.textContent = _prevProfileName;