Skip to content

Conversation

@lyzno1
Copy link
Contributor

@lyzno1 lyzno1 commented Jan 7, 2026

Summary

  • Fix signin page getting stuck on loading when user has valid refresh token but expired access token
  • Remove loginData?.logged_in from isLoading condition and use explicit isRedirecting state
  • Fix error handling in useIsLogin hook to treat any error as "not logged in"

Test plan

  • Verify signin page loads correctly when not logged in
  • Verify redirect works when user is already logged in
  • Verify page doesn't get stuck when access token expires but refresh token is valid
  • Verify error states (500, network errors) don't cause infinite loading

Fixes #30674

🤖 Generated with Claude Code

… token expired

This commit fixes two bugs that caused the signin page to get stuck on loading:

1. Remove `loginData?.logged_in` from isLoading condition in normal-form.tsx
   - Previously, when logged_in=true, isLoading was always true
   - Now use explicit `isRedirecting` state to track redirect status
   - This prevents infinite loading if router.replace fails or delays

2. Fix error handling in useIsLogin hook (use-common.ts)
   - Previously, non-401 errors (500, 403, network errors) were treated as logged in
   - Now any error is treated as "not logged in"

Fixes #30674

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 7, 2026 05:48
@lyzno1 lyzno1 requested review from douxc and iamjoel as code owners January 7, 2026 05:48
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 7, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @lyzno1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical issue where the signin page could become unresponsive, displaying a perpetual loading state, particularly when a user's access token had expired but a valid refresh token was present. It achieves this by refining the loading state management on the signin page and enhancing the useIsLogin hook's error handling to robustly determine a user's login status under various error conditions, ensuring a smoother user experience during authentication and redirection.

Highlights

  • Signin Page Loading State: Refactored the isLoading state on the signin page (normal-form.tsx) to remove direct dependency on loginData?.logged_in and instead use an explicit isRedirecting state to manage loading during user redirection.
  • Improved Login Status Detection: Enhanced the error handling within the useIsLogin hook (use-common.ts) to ensure that any error encountered during the /account/profile check (including 401, 500, or network errors) is correctly interpreted as the user not being logged in.
  • Resolved Stuck Loading Issue: Addressed the problem where the signin page would get stuck in a loading state when a user possessed a valid refresh token but an expired access token, by ensuring proper redirection and loading state management.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively resolves an issue where the sign-in page could get stuck in a loading state. The changes in web/service/use-common.ts correctly simplify the error handling within the useIsLogin hook, ensuring that any failure in fetching the user profile is treated as a 'not logged in' state. This is a crucial correctness fix. Additionally, the refactoring in web/app/signin/normal-form.tsx to use an explicit isRedirecting state for the loading indicator is a great improvement. It makes the component's state management more robust and its behavior more predictable during redirection. The changes are well-implemented and address the problem described.

Copy link
Contributor

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 bug where the signin page would get stuck on a loading screen when users have a valid refresh token but an expired access token. The fix involves two key changes: improving error handling in the login check hook and refactoring the loading state management to use an explicit redirect state.

  • Simplified error handling in useIsLogin to treat any error as "not logged in"
  • Removed problematic loginData?.logged_in from loading condition and added explicit isRedirecting state

Reviewed changes

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

File Description
web/service/use-common.ts Updated useIsLogin error handling to catch all errors instead of only checking for 401 status
web/app/signin/normal-form.tsx Fixed loading state logic by removing loginData?.logged_in from isLoading condition and introducing explicit isRedirecting state to prevent infinite loading

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lyzno1
Copy link
Contributor Author

lyzno1 commented Jan 7, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 7, 2026
@iamjoel iamjoel merged commit 160b4d1 into main Jan 7, 2026
20 checks passed
@iamjoel iamjoel deleted the fix/signin-loading-bug branch January 7, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Signin page stuck on loading when refresh token is valid but access token expired

3 participants