Skip to content

05.24 업데이트 - 책 이야기 카드에서 자기 자신 조회 시 리다이렉트 버그 수정 - #351

Merged
shinwokkang merged 2 commits into
mainfrom
dev
May 24, 2026
Merged

shinwokkang merged 2 commits into
mainfrom
dev

Conversation

@shinwokkang

@shinwokkang shinwokkang commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

📌 개요 (Summary)

  • 변경 사항에 대한 간략한 요약을 적어주세요.
  • 관련 이슈가 있다면 링크를 걸어주세요 (예: [fix] cicd / build 문제 #123).

🛠️ 변경 사항 (Changes)

  • 새로운 기능 추가
  • 버그 수정
  • 코드 리팩토링
  • 문서 업데이트
  • 기타 (설명: )

📸 스크린샷 (Screenshots)

(UI 변경 사항이 있다면 첨부해주세요)

✅ 체크리스트 (Checklist)

  • 빌드가 성공적으로 수행되었나요? (pnpm build)
  • 린트 에러가 없나요? (pnpm lint)
  • 불필요한 콘솔 로그나 주석을 제거했나요?

Summary by CodeRabbit

Bug Fixes

  • Optimized profile page navigation for authenticated users by implementing intelligent redirect logic that automatically guides them to their dashboard when visiting their own profile URL, enhancing overall user experience
  • Fixed profile link URL encoding in author profile references to ensure consistent and proper handling of special characters and reliable link formatting throughout the application

Review Change Stack

@vercel

vercel Bot commented May 24, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
checkmo Ready Ready Preview, Comment May 24, 2026 4:05am

@coderabbitai

coderabbitai Bot commented May 24, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

ProfileClient now redirects authenticated users to /profile/mypage when they access their own profile by nickname route. BookstoryDetail updates profile link generation to point to /profile/mypage for owned stories and properly encodes authorId in generated URLs for other users' profiles.

Changes

Profile Navigation Routing

Layer / File(s) Summary
Profile auth redirect and href generation
src/app/(main)/profile/[nickname]/ProfileClient.tsx, src/components/base-ui/BookStory/Detatil/bookstory_detail.tsx
ProfileClient imports useRouter and useAuthStore, then adds a useEffect that redirects to /profile/mypage when the authenticated user's nickname matches the route param. BookstoryDetail updates its profile href logic to use /profile/mypage when isMyStory is true and applies encodeURIComponent to authorId for other-user profile links.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly Related Issues

  • checkmo2025/FE#349: The BookstoryDetail change that points /profile/mypage for own stories and encodes authorId directly resolves the issue where clicking your own profile from a book story displayed incorrect profile UI.

Possibly Related PRs

  • checkmo2025/FE#263: Both PRs modify BookstoryDetail based on the isMyStory flag; this PR updates the profile href generation while the related PR adds isMyStory-driven edit/delete actions.

Poem

🐰 A hop through profiles, now unified and clean,
To /mypage we leap when we're the ones we've seen,
BookStory links encoded, authorId wrapped right,
Profile routes shimmer in the morning light! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: a redirect bug fix when viewing one's own profile from a book story card, which aligns with both file changes and commit message.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Copy link
Copy Markdown
Contributor

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 implements a redirect mechanism in the ProfileClient to send logged-in users to their personal 'mypage' when accessing their own public profile URL. It also updates the profile link logic in the BookstoryDetail component to handle self-links and URI encoding. Review feedback identifies a potential routing issue where authorNickname should be used instead of authorId to ensure compatibility with the profile route, and suggests returning null during the redirect in ProfileClient to prevent UI flickering and redundant data fetching.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/app/(main)/profile/[nickname]/ProfileClient.tsx (1)

20-24: ⚡ Quick win

Consider adding an early return to prevent flash of content.

The redirect happens in useEffect, which runs after the component renders. This means users will briefly see the other user's profile UI before being redirected to /profile/mypage. Consider adding an early return before the JSX to prevent this flash:

  useEffect(() => {
    if (isLoggedIn && user?.nickname && user.nickname === nickname) {
      router.replace("/profile/mypage");
    }
  }, [isLoggedIn, user?.nickname, nickname, router]);

+ if (isLoggedIn && user?.nickname && user.nickname === nickname) {
+   return null; // or return a loading spinner
+ }

  return (
    <div className="flex flex-col items-center gap-[10px] md:gap-[24px] w-full min-h-screen bg-[`#F9F7F6`] pb-[100px]">
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/`(main)/profile/[nickname]/ProfileClient.tsx around lines 20 - 24,
The component currently redirects inside useEffect causing a flash of the other
user's profile; add an early return at the top of the ProfileClient component
that checks the same condition (isLoggedIn && user?.nickname && user.nickname
=== nickname) and returns a placeholder (e.g., null or a small
loading/redirecting UI) so the JSX for the other user's profile does not render
before router.replace is run; keep the existing useEffect/router.replace logic
but guard rendering with this early return to prevent the flash.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/`(main)/profile/[nickname]/ProfileClient.tsx:
- Line 15: Routing and API nickname handling is inconsistent: decode/encode
flows differ between ProfileClient (const nickname =
decodeURIComponent(encodedNickname)), page.tsx generateMetadata (uses
encodedNickname directly in `/members/${encodedNickname}`), memberService
(URL-encodes), and UI links like FollowItem (build `/profile/${user.nickname}`
without encoding), which breaks names with reserved chars. Fix by choosing one
convention (treat route param as decoded) and apply it everywhere: always use
the route param decoded in ProfileClient and generateMetadata (decode
encodedNickname before using), URL-encode nicknames when constructing API paths
via memberService only, and ensure all link builders (e.g., FollowItem, any
hrefs to `/profile/${...}`) call encodeURIComponent(user.nickname) when
composing route URLs; update comparisons (user.nickname === nickname) to use the
same decoded canonical value from useAuthStore to keep self-redirect logic
consistent.

---

Nitpick comments:
In `@src/app/`(main)/profile/[nickname]/ProfileClient.tsx:
- Around line 20-24: The component currently redirects inside useEffect causing
a flash of the other user's profile; add an early return at the top of the
ProfileClient component that checks the same condition (isLoggedIn &&
user?.nickname && user.nickname === nickname) and returns a placeholder (e.g.,
null or a small loading/redirecting UI) so the JSX for the other user's profile
does not render before router.replace is run; keep the existing
useEffect/router.replace logic but guard rendering with this early return to
prevent the flash.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: deb6d44b-e54e-4b69-9fe7-e007cee831be

📥 Commits

Reviewing files that changed from the base of the PR and between 5670bfc and fc15843.

📒 Files selected for processing (2)
  • src/app/(main)/profile/[nickname]/ProfileClient.tsx
  • src/components/base-ui/BookStory/Detatil/bookstory_detail.tsx

@shinwokkang
shinwokkang merged commit a76fe88 into main May 24, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — fc15843f Deployed May 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug 버그 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants