Skip to content

FIX: show loading spinner when redirecting to discourse connect #34135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ZogStriP
Copy link
Member

@ZogStriP ZogStriP commented Aug 7, 2025

On "slow" computers and/or in production builds of the client-side application, the redirection to discourse connect (via window.location) might happen after the login/signup route is done loading and the login/signup template is being shown.

Since when discourse connect is enabled, no other auth "provider" is allowed, we "flashed" a screen that indicated there was no "login method" configured.

In order to fix this, we rely on the "isRedirectingToExternalAuth" boolean and ensure it's set to "true" when discourse connect is enabled.

This is unfortunately impossible very hard to test as it depends on how fast the browser running the test is...

The only way I was able to reproduce this issue locally was to throttle both the CPU and network in Chrome's performance tab.

Screenshot 2025-08-07 at 13 43 09

I also renamed isRedirecting to #isRedirecting to better indicate this is a private variable.


BEFORE

before.mov

AFTER

after.mov

On "slow" computers and/or in production builds of the client-side
application, the redirection to discourse connect (via window.location)
might happen _after_ the login/signup route is done loading and the
login/signup template is being shown.

Since when discourse connect is enabled, no other auth "provider" is
allowed, we "flashed" a screen that indicated there was no "login
method" configured.

In order to fix this, we rely on the "isRedirectingToExternalAuth"
boolean and ensure it's set to "true" when discourse connect is enabled.

This is unfortunately ~~impossible~~ very hard to test as it depends on
how fast the browser running the test is...
@ZogStriP ZogStriP requested review from pmusaraj and Copilot August 7, 2025 11:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a UX issue where a "no login method configured" screen briefly flashes before redirecting to discourse connect on slower systems. The fix ensures a loading spinner is shown during the redirection process.

  • Modified the isRedirectingToExternalAuth controller property to include discourse connect scenarios
  • Changed isRedirecting to a private field (#isRedirecting) for better encapsulation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
app/assets/javascripts/discourse/app/routes/signup.js Updated to show loading spinner when discourse connect is enabled and made isRedirecting field private
app/assets/javascripts/discourse/app/routes/login.js Applied identical changes to login route for consistency

Copy link
Contributor

@pmusaraj pmusaraj left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@ZogStriP ZogStriP merged commit 61b0a37 into main Aug 7, 2025
17 checks passed
@ZogStriP ZogStriP deleted the fix-show-loading-spinner-when-redirecting-to-discourse-connect branch August 7, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants