Skip to content

Conversation

@lsj1137
Copy link
Collaborator

@lsj1137 lsj1137 commented Feb 27, 2025

초대링크로 들어가서 구글 로그인할때 팀 가입 안되는 버그 수정
불필요한 useMemo 삭제

Summary by CodeRabbit

  • New Features

    • Enhanced the login experience with a streamlined team-joining flow during authentication, including a more seamless Google sign-in process.
  • Refactor

    • Simplified internal processes for both authentication and calendar scheduling to ensure a more consistent and responsive user experience.

@vercel
Copy link

vercel bot commented Feb 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
feedhanjum ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2025 8:20am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2025

Walkthrough

This pull request removes the dependency on the teamCode parameter across multiple authentication-related functions. The changes update the login flows by calling the team joining function without arguments, simplify the Google login process by directly appending the team code to the URL, and adjust the internal logic of the team joining hook. In addition, the scheduling hook has been refactored to remove memoization and perform direct time calculations.

Changes

File(s) Change Summary
front-end/.../api/useAuth.js, front-end/.../api/useTeamspace.js, front-end/.../pages/auth/Splash.jsx, front-end/.../pages/auth/SplashForOAuth.jsx Removed teamCode from the parameters of useLogin and useGoogleLogin; modified joinTeam calls to omit the team code; integrated the useJoinTeam hook for joining teams; simplified team-code handling in OAuth flows.
front-end/.../pages/calendar/hooks/useScheduleAction.jsx Removed useMemo for calculating the nearest time; now directly computes the current hour and minute from getNearest10MinTime.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SplashForOAuth
    participant GoogleLogin
    participant JoinTeam
    User->>SplashForOAuth: Initiates OAuth login
    SplashForOAuth->>GoogleLogin: Calls googleLogin(options)
    GoogleLogin-->>SplashForOAuth: Returns success
    alt Temporary team code exists
        SplashForOAuth->>JoinTeam: Invokes joinTeam()
    end
    SplashForOAuth->>User: Proceeds with navigation
Loading

Possibly related PRs

Suggested labels

FE, fix, refactor

Suggested reviewers

  • hammsik

Poem

I'm a hopping rabbit with code so neat,
Watching team codes vanish in each heartbeat.
No more extra parameters to weigh down the flow,
Join actions now glide and smoothly go.
In a meadow of refactors, I cheer—code on, let's go!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 965b5e2 and 15fb900.

📒 Files selected for processing (5)
  • front-end/src/api/useAuth.js (2 hunks)
  • front-end/src/api/useTeamspace.js (1 hunks)
  • front-end/src/pages/auth/Splash.jsx (2 hunks)
  • front-end/src/pages/auth/SplashForOAuth.jsx (2 hunks)
  • front-end/src/pages/calendar/hooks/useScheduleAction.jsx (1 hunks)
🔇 Additional comments (10)
front-end/src/pages/calendar/hooks/useScheduleAction.jsx (1)

10-14: Clean removal of useMemo improves code clarity.

Removing the unnecessary useMemo hook for calculating curHour and curMinute is a good change, as this calculation isn't expensive and only used for initialization. The direct assignment approach is cleaner and more straightforward.

front-end/src/pages/auth/Splash.jsx (2)

38-38: Simplified joinTeam call matches updated hook implementation.

This change works in conjunction with the updated useJoinTeam hook that now uses teamCode from its closure rather than as an argument.


48-48: Improved OAuth flow by passing teamCode in URL state.

Directly appending the teamCode to the URL state parameter is a cleaner approach than the previous implementation, which likely stored this information in localStorage. This change aligns with standard OAuth flow practices.

front-end/src/api/useTeamspace.js (2)

72-72: Improved null handling with a no-op function.

Returning a no-op function rather than null when there's no teamCode is a better pattern, as it prevents null checks at call sites.


77-79: Simplified mutation function signature.

The function now properly uses the teamCode from closure rather than requiring it to be passed as an argument. This creates a cleaner API and prevents inconsistencies between the provided teamCode and the one used internally.

front-end/src/pages/auth/SplashForOAuth.jsx (2)

9-9: Core fix for team joining via Google OAuth.

This change properly implements team joining during OAuth flow by:

  1. Importing useJoinTeam
  2. Retrieving the team code from the URL state parameter
  3. Setting up the joinTeam mutate function with the team code

This directly addresses the bug mentioned in the PR objectives about team joining via Google login.

Also applies to: 19-22


31-39: Robust error handling and team joining on successful login.

The implementation now:

  1. Properly uses the onSuccess callback
  2. Conditionally joins the team if a team code is present
  3. Cleans up by removing the temporary team code from localStorage

This change completes the fix for the Google OAuth team joining bug.

front-end/src/api/useAuth.js (3)

49-49: Interface modification for useJoinTeam

The change maintains passing teamCode to useJoinTeam but no longer passes it when calling the returned joinTeam function. This suggests that useJoinTeam has been updated to internally handle the team code.

This modification helps address the bug that prevented users from joining a team when logging in via Google through an invitation link.


57-57: Simplified joinTeam call

The joinTeam function is now called without parameters, relying on the teamCode that was already passed to useJoinTeam. This is a cleaner approach that centralizes the team code handling.

This simplification improves code maintainability by ensuring the team code is handled in a single place.


91-91: Removed teamCode parameter from useGoogleLogin

The teamCode parameter has been completely removed from the useGoogleLogin function signature, streamlining the authentication flow. This is consistent with the PR's objective to fix Google login through invitation links.

This change contributes to fixing the bug described in the PR objectives by simplifying the authentication flow. Team joining logic appears to have been moved elsewhere, likely to where the Google OAuth redirect is handled.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

setUserId(data.loginResponse.userId);
if (teamCode) {
joinTeam(teamCode);
localStorage.removeItem('tempTeamCode');
Copy link
Collaborator

Choose a reason for hiding this comment

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

로칼스토리지 캇!!

Copy link
Collaborator

@hammsik hammsik left a comment

Choose a reason for hiding this comment

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

막판까지 고생하셨습니다 흑흑

@hammsik hammsik merged commit ce4ddd4 into develop Feb 27, 2025
4 checks passed
@hammsik hammsik deleted the FD-418-프론트-자잘한-디버깅 branch February 27, 2025 08:24
@hammsik hammsik added FE 프론트엔드 풀 리퀘스트 fix labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FE 프론트엔드 풀 리퀘스트 fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants