Skip to content

Conversation

arvinxx
Copy link
Member

@arvinxx arvinxx commented Aug 16, 2025

๐Ÿ’ป ๅ˜ๆ›ด็ฑปๅž‹ | Change Type

  • โœจ feat
  • ๐Ÿ› fix
  • โ™ป๏ธ refactor
  • ๐Ÿ’„ style
  • ๐Ÿ‘ท build
  • โšก๏ธ perf
  • ๐Ÿ“ docs
  • ๐Ÿ”จ chore

๐Ÿ”€ ๅ˜ๆ›ด่ฏดๆ˜Ž | Description of Change

๐Ÿ“ ่กฅๅ……ไฟกๆฏ | Additional Information

Summary by Sourcery

Enhancements:

  • Display a loading spinner on the clicked OAuth provider button during sign-in

Copy link
Contributor

sourcery-ai bot commented Aug 16, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Introduces loading state management for OAuth sign-in buttons, showing a spinner on the active provider during sign-in to improve UX.

Class diagram for updated AuthSignInBox component loading state

classDiagram
  class AuthSignInBox {
    +useState<string | null> loadingProvider
    +handleSignIn(provider: string)
    +setLoadingProvider(provider: string | null)
  }
  AuthSignInBox --> OAuthProviderButton : renders
  class OAuthProviderButton {
    +loading: boolean
    +onClick: () => void
  }
Loading

File-Level Changes

Change Details Files
Manage loading state for OAuth providers
  • Introduce loadingProvider state via useState
  • Set loadingProvider to provider before signIn
  • Reset loadingProvider to null on error
src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx
Display loading indicator on provider buttons
  • Add loading prop comparing provider to loadingProvider
src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

vercel bot commented Aug 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
lobe-chat-database Ready Ready Preview Comment Aug 16, 2025 6:44am
lobe-chat-preview Ready Ready Preview Comment Aug 16, 2025 6:44am

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 16, 2025
@lobehubbot
Copy link
Member

๐Ÿ‘ @arvinxx

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
้žๅธธๆ„Ÿ่ฐขๆ‚จๆๅ‡บๆ‹‰ๅ–่ฏทๆฑ‚ๅนถไธบๆˆ‘ไปฌ็š„็คพๅŒบๅšๅ‡บ่ดก็Œฎ๏ผŒ่ฏท็กฎไฟๆ‚จๅทฒ็ป้ตๅพชไบ†ๆˆ‘ไปฌ็š„่ดก็ŒฎๆŒ‡ๅ—๏ผŒๆˆ‘ไปฌไผšๅฐฝๅฟซๅฎกๆŸฅๅฎƒใ€‚
ๅฆ‚ๆžœๆ‚จ้‡ๅˆฐไปปไฝ•้—ฎ้ข˜๏ผŒ่ฏท้šๆ—ถไธŽๆˆ‘ไปฌ่”็ณปใ€‚

Copy link
Contributor

gru-agent bot commented Aug 16, 2025

TestGru Assignment

Summary

Link CommitId Status Reason
Detail ae6acfd ๐Ÿšซ Skipped No files need to be tested {"src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx":"File path does not match include patterns."}

History Assignment

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

Copy link
Contributor

claude bot commented Aug 16, 2025

Claude finished @arvinxx's task โ€”โ€” View job


Code Review

Review Checklist

  • Read and analyze the changed file
  • Review for code quality and best practices
  • Check for potential bugs or issues
  • Assess performance considerations
  • Identify security concerns
  • Evaluate test coverage needs

Summary

This PR adds loading state management to the OAuth sign-in buttons, improving user experience by providing visual feedback during the authentication process.

Changes Overview

The PR introduces:

  1. A loadingProvider state to track which provider is currently being signed in
  2. Loading state display on the button that was clicked
  3. Proper error handling to reset the loading state on failure

โœ… Strengths

  1. Good UX improvement: Users now get immediate visual feedback when clicking a sign-in button
  2. Proper error handling: Loading state is correctly cleared when authentication fails
  3. Clean implementation: Minimal changes with focused scope
  4. Type safety: Proper TypeScript typing with useState<string | null>

๐Ÿ“ Suggestions for Improvement

1. Prevent Multiple Simultaneous Sign-ins

Currently, users can click other provider buttons while one is loading. Consider disabling all buttons during sign-in:

<Button
  className={styles.button}
  icon={AuthIcons(provider, 16)}
  key={provider}
  loading={loadingProvider === provider}
  disabled={loadingProvider !== null} // Disable all buttons when any is loading
  onClick={() => handleSignIn(provider)}
>
  {provider}
</Button>

2. Consider Edge Cases

The loading state might not reset if the signIn promise neither resolves nor rejects (though this is unlikely with NextAuth). Consider adding a timeout mechanism for robustness:

const handleSignIn = async (provider: string) => {
  setLoadingProvider(provider);
  const timeoutId = setTimeout(() => {
    setLoadingProvider(null);
  }, 30000); // 30 second timeout
  
  try {
    await signIn(provider, { redirectTo: callbackUrl });
    clearTimeout(timeoutId);
  } catch (error) {
    clearTimeout(timeoutId);
    setLoadingProvider(null);
    // ... rest of error handling
  }
};

๐Ÿ” Potential Issues

None identified. The implementation is straightforward and follows React best practices.

โšก Performance Considerations

No performance concerns. The state update is minimal and only affects the UI rendering of the buttons.

๐Ÿ”’ Security Considerations

No security issues identified. The loading state is purely cosmetic and doesn't affect the authentication flow security.

๐Ÿงช Test Coverage

Consider adding tests for:

  1. Loading state is shown when a provider button is clicked
  2. Loading state is cleared on authentication error
  3. Only the clicked button shows loading state
  4. User cannot trigger multiple simultaneous sign-ins (if implementing the suggestion above)

Verdict

LGTM! ๐Ÿ‘ This is a clean, focused improvement to the authentication UX. The suggestions above are optional enhancements that could further improve the robustness of the implementation.


@dosubot dosubot bot added the ๐Ÿ’„ Design Design an style | ๆ ทๅผ้—ฎ้ข˜ label Aug 16, 2025
@arvinxx arvinxx changed the title style improve auth sign in box loading ๐Ÿ’„ style: improve auth sign in loading Aug 16, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them โœจ
Help me be more useful! Please click ๐Ÿ‘ or ๐Ÿ‘Ž on each comment and I'll use the feedback to improve your reviews.

Copy link

codecov bot commented Aug 16, 2025

Codecov Report

โœ… All modified and coverable lines are covered by tests.
โœ… Project coverage is 85.58%. Comparing base (a1c66c8) to head (ae6acfd).
โš ๏ธ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #8805    +/-   ##
========================================
  Coverage   85.58%   85.58%            
========================================
  Files         935      935            
  Lines       72792    72792            
  Branches     6577     6811   +234     
========================================
  Hits        62296    62296            
  Misses      10496    10496            
Flag Coverage ฮ”
app 85.58% <รธ> (รธ)
server 96.26% <รธ> (รธ)

Flags with carried forward coverage won't be shown. Click here to find out more.

โ˜” View full report in Codecov by Sentry.
๐Ÿ“ข Have feedback on the report? Share it here.

๐Ÿš€ New features to boost your workflow:
  • โ„๏ธ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • ๐Ÿ“ฆ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arvinxx arvinxx merged commit 62f5a1b into main Aug 16, 2025
35 checks passed
@arvinxx arvinxx deleted the style/improve-next-login branch August 16, 2025 09:57
@lobehubbot
Copy link
Member

โค๏ธ Great PR @arvinxx โค๏ธ

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.
้กน็›ฎ็š„ๆˆ้•ฟ็ฆปไธๅผ€็”จๆˆทๅ้ฆˆๅ’Œ่ดก็Œฎ๏ผŒๆ„Ÿ่ฐขๆ‚จ็š„่ดก็Œฎ! ๅฆ‚ๆžœๆ‚จๅฏน LobeHub ๅผ€ๅ‘่€…็คพๅŒบๆ„Ÿๅ…ด่ถฃ๏ผŒ่ฏทๅŠ ๅ…ฅๆˆ‘ไปฌ็š„ discord๏ผŒ็„ถๅŽ็งไฟก @arvinxx ๆˆ– @canisminor1990ใ€‚ไป–ไปฌไผš้‚€่ฏทๆ‚จๅŠ ๅ…ฅๆˆ‘ไปฌ็š„็งๅฏ†ๅผ€ๅ‘่€…้ข‘้“ใ€‚ๆˆ‘ไปฌๅฐ†ไผš่ฎจ่ฎบๅ…ณไบŽ Lobe Chat ็š„ๅผ€ๅ‘๏ผŒๅˆ†ไบซๅ’Œ่ฎจ่ฎบๅ…จ็ƒ่Œƒๅ›ดๅ†…็š„ AI ๆถˆๆฏใ€‚

github-actions bot pushed a commit that referenced this pull request Aug 16, 2025
### [Version&nbsp;1.112.1](v1.112.0...v1.112.1)
<sup>Released on **2025-08-16**</sup>

#### ๐Ÿ’„ Styles

- **misc**: Add Imagen 4 GA models, style improve auth sign in box loading.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Styles

* **misc**: Add Imagen 4 GA models, closes [#8799](#8799) ([2e9ad20](2e9ad20))
* **misc**: Style improve auth sign in box loading, closes [#8805](#8805) ([62f5a1b](62f5a1b))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Member

๐ŸŽ‰ This PR is included in version 1.112.1 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

github-actions bot pushed a commit to jaworldwideorg/OneJA-Bot that referenced this pull request Aug 18, 2025
## [Version&nbsp;1.113.0](v1.112.0...v1.113.0)
<sup>Released on **2025-08-18**</sup>

#### โ™ป Code Refactoring

- **misc**: Refactor const folder to a new package, refactor prompts folder to the `@lobechat/prompts` pacakge, ้‡ๆž„ArgsInput็ป„ไปถ.

#### โœจ Features

- **provider**: Add BFL provider support for image generation.

#### ๐Ÿ› Bug Fixes

- **db**: Desktop local db can't vectorization.
- **misc**: Improve mcp tracing with user config.

#### ๐Ÿ’„ Styles

- **misc**: Add Imagen 4 GA models, style improve auth sign in box loading.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

* **misc**: Refactor const folder to a new package, closes [lobehub#8756](https://github.com/jaworldwideorg/OneJA-Bot/issues/8756) ([30a4734](30a4734))
* **misc**: Refactor prompts folder to the `@lobechat/prompts` pacakge, closes [lobehub#8810](https://github.com/jaworldwideorg/OneJA-Bot/issues/8810) ([d82e7bb](d82e7bb))
* **misc**: ้‡ๆž„ ArgsInput ็ป„ไปถ, closes [lobehub#8765](https://github.com/jaworldwideorg/OneJA-Bot/issues/8765) ([0905559](0905559))

#### What's improved

* **provider**: Add BFL provider support for image generation, closes [lobehub#8806](https://github.com/jaworldwideorg/OneJA-Bot/issues/8806) ([519e03e](519e03e))

#### What's fixed

* **db**: Desktop local db can't vectorization, closes [lobehub#8830](https://github.com/jaworldwideorg/OneJA-Bot/issues/8830) ([a00fd9d](a00fd9d))
* **misc**: Improve mcp tracing with user config, closes [lobehub#8827](https://github.com/jaworldwideorg/OneJA-Bot/issues/8827) ([5cab2ee](5cab2ee))

#### Styles

* **misc**: Add Imagen 4 GA models, closes [lobehub#8799](https://github.com/jaworldwideorg/OneJA-Bot/issues/8799) ([2e9ad20](2e9ad20))
* **misc**: Style improve auth sign in box loading, closes [lobehub#8805](https://github.com/jaworldwideorg/OneJA-Bot/issues/8805) ([62f5a1b](62f5a1b))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐Ÿ’„ Design Design an style | ๆ ทๅผ้—ฎ้ข˜ released size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants