Skip to content

Conversation

@toothlessdev
Copy link
Member

@toothlessdev toothlessdev commented Aug 27, 2025

✅ Linked Issue

🔍 What I did

  • 프로필 수정 및 등록 버튼 클릭시 disabled 처리 및 spinner 추가

Summary by CodeRabbit

  • New Features
    • Profile edit and registration pages now show a loading spinner during submission.
    • Submit buttons are disabled while updates are in progress to prevent duplicate actions.
    • Button labels are clarified for better user understanding during non-loading states.

@toothlessdev toothlessdev self-assigned this Aug 27, 2025
@toothlessdev toothlessdev requested a review from kimgho August 27, 2025 16:33
@vercel
Copy link

vercel bot commented Aug 27, 2025

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

Project Deployment Preview Comments Updated (UTC)
mosu-client Ready Ready Preview Comment Aug 27, 2025 4:34pm

@coderabbitai
Copy link

coderabbitai bot commented Aug 27, 2025

Walkthrough

Introduces loading state handling for profile register and edit pages by consuming isPending from their respective hooks, disabling submit buttons, and showing a Spinner during pending states. Updates hooks’ return signatures to include isPending.

Changes

Cohort / File(s) Summary
Profile Register Page: pending state UI
mosu-app/src/pages/mypage/profile/register.tsx
Imports Spinner, destructures { isPending, mutate } from useRegisterProfile, disables submit when pending, conditionally renders Spinner vs. "등록하기".
Profile Edit Page: pending state UI
mosu-app/src/pages/mypage/profile/edit.tsx
Imports Spinner, destructures { isPending, mutate } from useEditProfile, disables submit when pending, conditionally renders Spinner; default label now "프로필 수정하기".
Users services hooks signature
.../src/entities/users/services/registerProfile*, .../src/entities/users/services/editProfile*
Hooks now return { isPending, mutate } instead of only mutate. Public API change.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant R as RegisterProfile Page
  participant H as useRegisterProfile Hook
  participant API as Users API

  U->>R: Click "등록하기"
  R->>H: if (!isPending) mutate(formData)
  alt First click (isPending=false)
    H->>API: POST /profiles
    H-->>R: isPending=true
    R-->>U: Show Spinner, disable button
    API-->>H: Response (success/error)
    H-->>R: isPending=false
    R-->>U: Re-enable button, update UI
  else While pending (isPending=true)
    R-->>U: Ignore submit (no API call)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Prevent API requests from being triggered while pending on the profile registration page (#374)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add pending state UI and button behavior on profile edit page (mosu-app/src/pages/mypage/profile/edit.tsx) The linked issue targets the registration page only; edit page changes are not referenced.
Expose isPending in useEditProfile hook signature (.../src/entities/users/services/editProfile*) The issue concerns registration flow; changing the edit hook API is not required by the objective.

Suggested labels

기능 구현, 우선순위 (상)

Suggested reviewers

  • kimgho

Poem

A whisk of code, a Spinner’s glow,
I tap submit—no double-go!
While bytes hop forth, the button rests,
A bunny guards concurrent requests.
One hop, one post, then all is right—
Profile blooms by morning light. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix#374

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@sonarqubecloud
Copy link

@github-actions
Copy link

Messages
📖 ✅ PR 제목에 이슈 번호가 포함되어 있습니다.
📖 ✅ PR에 Reviewers가 지정되어 있습니다.
📖 ✅ PR에 라벨이 지정되어 있습니다.
📖 ✅ PR에 Assignees가 지정되어 있습니다.
📖 ✅ package.json에 변경사항이 없습니다.
📖 ✅ 브랜치 이름 'fix#374'이 컨벤션을 따릅니다.
📖 ✅ TypeScript 컴파일이 성공적으로 완료되었습니다.
📖 ✅ ESLint 검사 결과 문제가 없습니다.

📝 추가 및 변경된 파일

총 2개 파일 변경

└── 📂 mosu-app/
    └── 📂 src/
        └── 📂 pages/
            └── 📂 mypage/
                └── 📂 profile/
                    ├── ⚛️ edit.tsx
                    └── ⚛️ register.tsx

Generated by 🚫 dangerJS against 5b8c1c2

@github-actions
Copy link

📚 Storybook이 Chromatic에 배포되었습니다!

@toothlessdev toothlessdev merged commit 4aee432 into main Aug 27, 2025
10 of 11 checks passed
@toothlessdev toothlessdev deleted the fix#374 branch August 27, 2025 16:37
@github-project-automation github-project-automation bot moved this from 진행중 to 완료 in mosu-client Aug 27, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
mosu-app/src/pages/mypage/profile/edit.tsx (1)

85-104: Guard against re-entrancy; block submits while pending (Enter key, IME confirm, etc.).

Disabling the button alone doesn’t stop form-submit paths other than clicking. Add an early return when pending to guarantee no extra API calls fire during an in-flight mutation.

Apply:

-    const onSubmit = handleSubmit(
-        (data) => {
-            mutate(data, {
+    const onSubmit = handleSubmit(
+        (data) => {
+            if (isPending) return;
+            mutate(data, {
                 onSuccess: () => {
                     toast.success("프로필이 수정되었습니다.");
                     router.push("/mypage");
                 },
                 onError: (error) => {
                     if (error instanceof HTTPException) {
                         toast.error(error.message);
                         return;
                     }
                     toast.error("프로필 수정에 실패했습니다. 다시 시도해주세요.");
                 },
             });
         },
mosu-app/src/pages/mypage/profile/register.tsx (1)

83-102: Add re-entrancy guard to fully satisfy “no requests while pending.”

Prevent duplicate submissions via Enter key or rapid interactions by short-circuiting when pending.

Apply:

-    const onSubmit = handleSubmit(
-        (data) => {
-            mutate(data, {
+    const onSubmit = handleSubmit(
+        (data) => {
+            if (isPending) return;
+            mutate(data, {
                 onSuccess: () => {
                     toast.success("프로필이 등록되었습니다.");
                     router.push("/");
                 },
                 onError: (error) => {
                     if (error instanceof HTTPException) {
                         toast.error(error.message);
                         return;
                     }
                     toast.error("프로필 등록에 실패했습니다. 다시 시도해주세요.");
                 },
             });
         },
🧹 Nitpick comments (2)
mosu-app/src/pages/mypage/profile/edit.tsx (1)

207-209: Improve UX/a11y on submit button; ensure submit semantics and visible spinner.

  • Add type="submit" and aria-busy for accessibility.
  • Inherit color via currentColor so the spinner stays visible across themes.

Apply:

-                    <Button variant="default" className="my-10 h-[60px] w-full" disabled={isPending}>
-                        {isPending ? <Spinner /> : "프로필 수정하기"}
+                    <Button
+                        type="submit"
+                        variant="default"
+                        className="my-10 h-[60px] w-full"
+                        aria-busy={isPending}
+                        disabled={isPending}
+                    >
+                        {isPending ? <Spinner color="currentColor" /> : "프로필 수정하기"}
                     </Button>
mosu-app/src/pages/mypage/profile/register.tsx (1)

210-212: Button semantics + spinner visibility.

Add type="submit", aria-busy, and use currentColor for Spinner to ensure visibility across themes.

Apply:

-                    <Button variant="default" className="my-10 h-[60px] w-full" disabled={isPending}>
-                        {isPending ? <Spinner /> : "등록하기"}
+                    <Button
+                        type="submit"
+                        variant="default"
+                        className="my-10 h-[60px] w-full"
+                        aria-busy={isPending}
+                        disabled={isPending}
+                    >
+                        {isPending ? <Spinner color="currentColor" /> : "등록하기"}
                     </Button>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a4322ac and 5b8c1c2.

📒 Files selected for processing (2)
  • mosu-app/src/pages/mypage/profile/edit.tsx (3 hunks)
  • mosu-app/src/pages/mypage/profile/register.tsx (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
mosu-app/src/pages/mypage/profile/register.tsx (2)
mosu-app/src/entities/users/services/registerProfile.ts (1)
  • useRegisterProfile (17-21)
mosu-app/src/shared/components/Spinner/Spinner.tsx (1)
  • Spinner (9-38)
mosu-app/src/pages/mypage/profile/edit.tsx (2)
mosu-app/src/entities/users/services/editProfile.ts (1)
  • useEditProfile (19-23)
mosu-app/src/shared/components/Spinner/Spinner.tsx (1)
  • Spinner (9-38)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build & Publish Storybook
🔇 Additional comments (4)
mosu-app/src/pages/mypage/profile/edit.tsx (2)

25-25: Spinner import looks good.


83-83: React Query v5 confirmed — isPending is correct

I’ve verified in mosu-app/package.json that the project uses @tanstack/react-query@^5.76.0, and the useEditProfile hook returns the v5-style mutation object (which exposes isPending rather than isLoading). No changes are necessary here—your button disabling will work as expected.

mosu-app/src/pages/mypage/profile/register.tsx (2)

25-25: Spinner import looks good.


81-81: Confirm React Query version; isPending vs isLoading.

Same as edit page: ensure we’re on @tanstack/react-query v5 or adapt to isLoading (v4) so the disabled state engages.

Reuse the script from the other comment; it checks the package version and scans for isPending/isLoading usage patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 완료

Development

Successfully merging this pull request may close these issues.

[🐞 버그 리포트] 프로필 등록페이지에서, pending 상태에도 API 요청이 호출되는 현상

2 participants