-
Notifications
You must be signed in to change notification settings - Fork 0
fix: QA 2차 수정 #172
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: QA 2차 수정 #172
Changes from all commits
5f3ab88
39c0035
4554d02
06ec524
2a28438
ba3d2e1
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,6 +5,7 @@ import TabBar from '../../components/feed/TabBar'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import MyFeed from '../../components/feed/MyFeed'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import TotalFeed from '../../components/feed/TotalFeed'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import MainHeader from '@/components/common/MainHeader'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import LoadingSpinner from '../../components/common/LoadingSpinner'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import writefab from '../../assets/common/writefab.svg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useNavigate, useLocation } from 'react-router-dom'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { getTotalFeeds } from '@/api/feeds/getTotalFeed'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -43,6 +44,11 @@ const Feed = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [myNextCursor, setMyNextCursor] = useState<string>(''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [myIsLast, setMyIsLast] = useState(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 탭 전환 시 로딩 상태 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [tabLoading, setTabLoading] = useState(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 초기 로딩 상태 (첫 진입 시) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [initialLoading, setInitialLoading] = useState(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const handleSearchButton = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| navigate('/feed/search'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -157,10 +163,17 @@ const Feed = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (activeTab === '피드') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| loadTotalFeeds(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (activeTab === '내 피드') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| loadMyFeeds(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setTabLoading(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (activeTab === '피드') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await loadTotalFeeds(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (activeTab === '내 피드') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await loadMyFeeds(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } finally { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setTabLoading(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setInitialLoading(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+166
to
177
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. 토큰 미존재 시 초기 로딩이 영구 지속되는 버그 가능성 현재 토큰이 없으면 Line 160-164에서 조기 return 되며, 이 분기는 try/finally 블록(여기, Line 169-177) 바깥이어서 setInitialLoading(false)가 호출되지 않습니다. 결과적으로 스피너가 영구히 떠 있을 수 있습니다. 최소 수정안: 토큰 체크를 try/finally 내부로 옮기거나, 조기 return 전에 initialLoading을 false로 내려주세요. 권장 수정 예시(토큰 체크를 try/finally 안으로 이동): - // localStorage에 토큰이 있는지 확인
- const authToken = localStorage.getItem('authToken');
- if (!authToken) {
- console.log('❌ 토큰이 없어서 피드를 로드할 수 없습니다.');
- return;
- }
-
- setTabLoading(true);
- try {
- if (activeTab === '피드') {
- await loadTotalFeeds();
- } else if (activeTab === '내 피드') {
- await loadMyFeeds();
- }
- } finally {
- setTabLoading(false);
- setInitialLoading(false);
- }
+ setTabLoading(true);
+ try {
+ // localStorage에 토큰이 있는지 확인
+ const authToken = localStorage.getItem('authToken');
+ if (!authToken) {
+ console.log('❌ 토큰이 없어서 피드를 로드할 수 없습니다.');
+ return; // finally 보장
+ }
+ if (activeTab === '피드') {
+ await loadTotalFeeds();
+ } else if (activeTab === '내 피드') {
+ await loadMyFeeds();
+ }
+ } finally {
+ setTabLoading(false);
+ setInitialLoading(false);
+ }대안: 조기 return 직전에 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -171,18 +184,24 @@ const Feed = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Container> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <MainHeader type="home" leftButtonClick={handleSearchButton} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TabBar tabs={tabs} activeTab={activeTab} onTabClick={setActiveTab} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {activeTab === '피드' ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TotalFeed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showHeader={true} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| posts={totalFeedPosts} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isMyFeed={false} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isLast={totalIsLast} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {initialLoading || tabLoading ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <LoadingSpinner size="large" fullHeight={true} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <MyFeed showHeader={false} posts={myFeedPosts} isMyFeed={true} isLast={myIsLast} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {activeTab === '피드' ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TotalFeed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showHeader={true} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| posts={totalFeedPosts} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isMyFeed={false} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isLast={totalIsLast} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <MyFeed showHeader={false} posts={myFeedPosts} isMyFeed={true} isLast={myIsLast} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <NavBar src={writefab} path="/post/create" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
OG 이미지 URL 전환(.png → .jpeg) 자체는 적절합니다만, 배포 전 헤더/용량/타입을 점검하세요.
소셜 미리보기 안정성을 위해 200 OK,
Content-Type: image/jpeg, 적절한Cache-Control, 과도하지 않은 용량(권장 < 1MB)을 확인하면 좋습니다. 또, 변경 직후 크롤러 캐시 영향이 있을 수 있으니 URL 접근성도 함께 확인 바랍니다.다음 스크립트로 기본 헤더와 용량을 점검할 수 있습니다:
또한 최소 권장 해상도(예: 1200x630)에 부합하는지 확인이 필요하면, 아래 스크립트로 이미지 실제 해상도를 점검할 수 있습니다:
필요하시면 위 검증을 CI에 넣을 간단한 체크 스크립트도 마련해 드릴 수 있습니다.
🏁 Script executed:
Length of output: 1151
🏁 Script executed:
Length of output: 146
OG 이미지 HTTP 응답 검증 필요: 최종 URL 헤더·타입·용량 점검
소셜 미리뷰 안정화를 위해, 아래 사항을 꼭 확인하세요.
→ curl -sI -L 로 최종 응답 헤더를 확인해야 함
아래 스크립트로 기본 검증을 수행할 수 있습니다:
필요 시 해상도(권장 1200×630 이상) 확인용 스크립트 예:
🤖 Prompt for AI Agents