feat: improve organization switching experience with a branded loading overlay and session management for smoother transitions

This commit is contained in:
Usman Baig
2026-02-22 20:48:09 +01:00
parent 8007900940
commit c73c300620
4 changed files with 37 additions and 11 deletions

View File

@@ -33,8 +33,8 @@ export default function OrganizationSwitcher({ orgs, activeOrgId }: { orgs: Orga
// * Note: switchContext only returns access_token, we keep existing refresh token
await setSessionAction(access_token)
// Force reload to pick up new permissions
window.location.reload()
sessionStorage.setItem('pulse_switching_org', 'true')
window.location.reload()
} catch (err) {
console.error('Failed to switch organization', err)

View File

@@ -419,10 +419,11 @@ export default function OrganizationSettings() {
try {
const { access_token } = await switchContext(null)
await setSessionAction(access_token)
sessionStorage.setItem('pulse_switching_org', 'true')
window.location.href = '/'
} catch (switchErr) {
console.error('Failed to switch to personal context after delete:', switchErr)
// Fallback: reload and let backend handle invalid token if any
sessionStorage.setItem('pulse_switching_org', 'true')
window.location.href = '/'
}