Skip to content

Fix full page reload after login - #5837

Merged
norman-abramovitz merged 1 commit into
cloudfoundry:developfrom
nabramovitz:fix/login-double-redirect
Aug 23, 2026
Merged

Fix full page reload after login#5837
norman-abramovitz merged 1 commit into
cloudfoundry:developfrom
nabramovitz:fix/login-double-redirect

Conversation

@nabramovitz

Copy link
Copy Markdown
Contributor

After a successful login the console rendered /home, blanked the whole app, and re-rendered — a visible full page reload on every sign-in.

Cause

handleSuccessfulLogin ran twice for the same login: the click handler and the ngOnInit existing-session auto-redirect both fire when auth becomes "logged in + valid", so two concurrent router.navigate(['/home']) calls collide. With onSameUrlNavigation: 'reload' the router cancels one, which resolves false and drops into the window.location.href fallback — a full document reload. A HAR of the login confirmed a single script-initiated document GET /home (an in-app router navigation issues no document request).

Fix

Guard handleSuccessfulLogin so the redirect runs once. With one navigation nothing is cancelled, navResult is true, the fallback never fires, and /home renders a single time. The window.location.href fallback still covers a genuine navigation failure.

Includes a regression test asserting a single router.navigate when both triggers fire.

After a successful login the console rendered /home, blanked the whole
app, and re-rendered. handleSuccessfulLogin ran twice — the click handler
and the existing-session auto-redirect both fire on the same
logged-in+valid state — so two concurrent router.navigate(['/home'])
calls collided; the router cancelled one (resolving false), which fell
through to the window.location.href fallback and forced a full document
reload. Guard the redirect so it runs once; the fallback then only fires
on a genuine navigation failure.

@norman-abramovitz norman-abramovitz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@norman-abramovitz
norman-abramovitz merged commit dedc937 into cloudfoundry:develop Aug 23, 2026
23 checks passed
@nabramovitz
nabramovitz deleted the fix/login-double-redirect branch August 23, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants