-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 라우팅 경로 수정 #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 라우팅 경로 수정 #111
Changes from all commits
0c9a63f
bcb9625
70fdec4
2c1e233
489633e
77fc4b5
0cda714
4e8068c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ import { | |
| RouterProvider, | ||
| } from 'react-router-dom'; | ||
| import Login from './login/Login'; | ||
| import Signup from './signup/Signup'; | ||
| // import Signup from './signup/Signup'; | ||
| import SignupGenre from './signup/SignupGenre'; | ||
| import SignupNickname from './signup/SignupNickname'; | ||
| import SignupDone from './signup/SignupDone'; | ||
|
|
@@ -44,10 +44,8 @@ const Router = () => { | |
| createRoutesFromElements( | ||
| <> | ||
| <Route path="/" element={<Login />} /> | ||
| <Route path="signup" element={<Signup />}> | ||
| <Route index element={<SignupNickname />} /> | ||
| <Route path="genre" element={<SignupGenre />} /> | ||
| </Route> | ||
| <Route path="signup" element={<SignupNickname />} /> | ||
| <Route path="signup/genre" element={<SignupGenre />} /> | ||
|
Comment on lines
+47
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain중첩 → 평면 라우트 전환은 타당하지만, 부모(Signup) 레이아웃/가드 소실 여부를 확인해주세요 이전 구조에서
필요 시, 적용 예시(가드 컴포넌트가 있다는 전제): - <Route path="signup" element={<SignupNickname />} />
- <Route path="signup/genre" element={<SignupGenre />} />
+ <Route path="signup" element={<SignupNickname />} />
+ <Route
+ path="signup/genre"
+ element={
+ <SignupGuard>
+ <SignupGenre />
+ </SignupGuard>
+ }
+ />가드 예시 구현(외부 파일; 실제 앱 상태소스에 맞게 수정 필요): import { Navigate, useLocation } from 'react-router-dom';
// TODO: 실제 구현으로 교체(예: Redux/Zustand/Recoil/Query 등에서 닉네임 완료 여부 읽기)
function useCanProceedToGenre() {
return false;
}
export function SignupGuard({ children }: { children: React.ReactNode }) {
const canProceed = useCanProceedToGenre();
const location = useLocation();
if (!canProceed) {
return <Navigate to="/signup" replace state={{ from: location }} />;
}
return <>{children}</>;
}아래 스크립트로 잠재 리스크를 빠르게 점검할 수 있습니다. 🏁 Script executed: #!/bin/bash
# 1) Signup 래퍼 파일 존재 여부 확인
fd -a --glob 'src/**/signup/Signup.*'
# 2) Outlet/OutletContext 의존성 확인(부모 컨텍스트 의존 여부)
rg -n -A2 -B2 $'useOutletContext|<Outlet' src
# 3) 상대 네비게이션(genre) 사용처 확인
rg -n -A1 -B1 $'navigate\\([\'"]genre[\'"]\\)|to=[\'"]genre[\'"]' srcLength of output: 361 Signup.tsx의 미사용 레이아웃 확인 및 중첩 구조 적용 여부 결정 현재 검증 결과:
해결 방향 제안:
<Routes>
- <Route path="signup" element={<SignupNickname />} />
- <Route path="signup/genre" element={<SignupGenre />} />
+ <Route path="signup" element={<Signup />}>
+ <Route index element={<SignupNickname />} />
+ <Route
+ path="genre"
+ element={
+ <SignupGuard>
+ <SignupGenre />
+ </SignupGuard>
+ }
+ />
+ </Route>
</Routes>필요하다면, 다음과 같은 가드 컴포넌트를 참고해 실제 앱 상태 관리 로직에 맞춰 구현하세요: import { Navigate, useLocation } from 'react-router-dom';
function useCanProceedToGenre() {
// TODO: 닉네임 완료 여부 등을 실제 상태에서 읽어오기
return false;
}
export function SignupGuard({ children }: { children: React.ReactNode }) {
const canProceed = useCanProceedToGenre();
const location = useLocation();
return canProceed
? <>{children}</>
: <Navigate to="/signup" replace state={{ from: location }} />;
}🤖 Prompt for AI Agents |
||
| <Route path="signupdone" element={<SignupDone />} /> | ||
| <Route path="post/create" element={<CreatePost />} /> | ||
| <Route path="group" element={<Group />} /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
요청 필드명
nickName→nickname변경 반영 👍타입 정의가 깔끔하게 정리되었습니다. 이제 호출부 전역에서 남아있는
nickName사용이 없는지만 확인하면 됩니다.레거시 키워드 잔존 여부를 점검하는 스크립트입니다.
🏁 Script executed:
Length of output: 430
레거시 필드명
nickName사용 잔존 – 추가 변경 필요다음 파일에서 여전히
nickName이 사용되고 있으니, 전부nickname으로 변경해주세요:🤖 Prompt for AI Agents