Skip to content

Conversation

imddoy
Copy link
Contributor

@imddoy imddoy commented Oct 20, 2025

🤫 쉿, 나한테만 말해줘요. 이슈넘버

🧐 어떤 것을 변경했어요~?

iOS 웹뷰인 경우 user agent 값을 기준으로 예외처리 했습니다.

🤔 그렇다면, 어떻게 구현했어요~?

image 위의 사진처럼 iOS 선생님들이 user agent에 SOPT-iOS 문자열을 추가해주셔서 해당 문자열로 비교했습니다.

❤️‍🔥 당신이 생각하는 PR포인트, 내겐 매력포인트.

📸 스크린샷, 없으면 이것 참,, 섭섭한데요?

image
[user agent를 SOPT-iOS로 지정한 경우] image
[Safari로 iOS로 접속한 경우]

@imddoy imddoy self-assigned this Oct 20, 2025
@github-actions github-actions bot requested a review from seong-hui October 20, 2025 17:01
Copy link

coderabbitai bot commented Oct 20, 2025

Summary by CodeRabbit

버그 수정

  • iOS 웹뷰 환경에서 사용자 인터페이스 레이아웃이 최적화되었습니다. iOS 앱 내 웹뷰에서 접근할 때 불필요한 UI 요소가 제거되어 더욱 개선된 사용 경험을 제공합니다.

안내

Walkthrough

iOS WebView 환경을 감지하는 런타임 체크를 추가하여 DetailFeedCard의 Header 컴포넌트에서 왼쪽 요소의 조건부 렌더링을 구현했습니다. iOS 앱에서는 왼쪽 요소를 표시하지 않고 다른 플랫폼에서는 기존 동작을 유지합니다.

Changes

Cohort / File(s) 변경 요약
iOS WebView 감지 및 조건부 렌더링
src/components/feed/detail/DetailFeedCard.tsx
navigator.userAgent에서 /SOPT-iOS/ 패턴 감지를 통해 iOS WebView 여부를 판단하는 isIOSApp 런타임 체크 추가. iOS 앱 환경에서는 왼쪽 컨테이너 렌더링을 생략하고, 다른 환경에서는 기존의 24x24 왼쪽 영역을 렌더링하는 조건부 로직 구현.

Sequence Diagram

sequenceDiagram
    participant Browser/App
    participant Header Component
    participant Render Logic

    alt iOS WebView
        Browser/App->>Header Component: userAgent contains SOPT-iOS
        Header Component->>Header Component: isIOSApp = true
        Header Component->>Render Logic: Skip left element
        Render Logic-->>Browser/App: Render without left button
    else Other Platforms
        Browser/App->>Header Component: userAgent without SOPT-iOS
        Header Component->>Header Component: isIOSApp = false
        Header Component->>Render Logic: Render left element
        Render Logic-->>Browser/App: Render with 24x24 left area
    end
Loading

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8분

Poem

🐰 iOS 앱에서 뛰어난 마법을 부렸네!
중복된 버튼은 이제 사라졌고,
웹뷰를 재치있게 감지하며,
플랫폼마다 다르게 춤을 춘다네,
사용자의 손가락이 한 번에 가볼까! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed 제목 "fix: iOS 앱 내 웹뷰인 경우 커뮤니티 상세페이지 이전 버튼 제거"는 변경 사항의 핵심을 명확하게 설명합니다. iOS WebView에서 백 버튼을 제거한다는 주요 변경 사항을 직접적으로 반영하고 있으며, 구체적이고 명확하며 잡음 없이 작성되었습니다.
Linked Issues Check ✅ Passed 이슈 #2011의 요구사항은 iOS WebView로 진입한 경우 상세페이지에서 백 버튼을 표시하지 않는 것입니다. 제출된 변경 사항은 /SOPT-iOS/.test(navigator.userAgent) 방식으로 iOS WebView를 감지하고, isIOSApp이 true일 때 left element를 렌더링하지 않음으로써 이 요구사항을 정확하게 구현하고 있습니다.
Out of Scope Changes Check ✅ Passed 모든 변경 사항은 src/components/feed/detail/DetailFeedCard.tsx 파일에서 iOS WebView 감지 및 백 버튼 조건부 렌더링으로 제한되어 있으며, 이는 이슈 #2011의 해결을 위해 필요한 변경입니다. 범위를 벗어난 수정이나 무관한 변경사항은 발견되지 않습니다.
Description Check ✅ Passed 설명은 변경 사항과 명확하게 관련되어 있습니다. iOS WebView 감지를 위해 user agent에서 "SOPT-iOS" 문자열을 사용하는 구현 방식을 설명하고 있으며, 변경 전후를 비교한 스크린샷도 포함되어 있습니다. 또한 해결하려는 문제와 구현 로직을 체계적으로 설명하고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/#2011

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.

Copy link

🚀 프리뷰 배포 확인하기 🚀

https://4e5977ec.sopt-internal-dev.pages.dev

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: 1

🧹 Nitpick comments (1)
src/components/feed/detail/DetailFeedCard.tsx (1)

79-79: 더 명확한 조건부 렌더링 패턴을 사용하세요.

현재 {isIOSApp || <div>...</div>} 구문은 동작하지만 일반적이지 않은 패턴입니다. React에서는 요소를 숨기려는 의도를 명확히 표현하기 위해 {!condition && <element>} 패턴을 사용하는 것이 더 일반적입니다.

다음과 같이 수정하면 가독성이 향상됩니다:

-        {isIOSApp || <div css={{ width: '24px', height: '24px' }}>{left}</div>}
+        {!isIOSApp && <div css={{ width: '24px', height: '24px' }}>{left}</div>}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0d5cdb and 9cd8dda.

📒 Files selected for processing (1)
  • src/components/feed/detail/DetailFeedCard.tsx (1 hunks)
⏰ 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). (2)
  • GitHub Check: build-app / build
  • GitHub Check: chromatic-deploy

Comment on lines +74 to +75
const isIOSApp = /SOPT-iOS/.test(navigator.userAgent); // iOS 앱 내 웹뷰 여부

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

SSR 환경에서 런타임 에러가 발생합니다.

Next.js는 서버 사이드 렌더링을 지원하는데, navigator 객체는 브라우저에서만 사용 가능합니다. 서버에서 이 코드가 실행되면 ReferenceError: navigator is not defined 에러가 발생합니다.

다음 중 한 가지 방법으로 수정하세요:

방법 1 (권장): typeof 체크로 안전하게 접근

-  const isIOSApp = /SOPT-iOS/.test(navigator.userAgent); // iOS 앱 내 웹뷰 여부
+  const isIOSApp = typeof navigator !== 'undefined' && /SOPT-iOS/.test(navigator.userAgent); // iOS 앱 내 웹뷰 여부

방법 2: useEffect를 사용하여 클라이언트에서만 실행

+  const [isIOSApp, setIsIOSApp] = useState(false);
+
+  useEffect(() => {
+    setIsIOSApp(/SOPT-iOS/.test(navigator.userAgent));
+  }, []);
-  const isIOSApp = /SOPT-iOS/.test(navigator.userAgent); // iOS 앱 내 웹뷰 여부

방법 1이 더 간단하고 hydration mismatch 없이 즉시 올바른 UI를 렌더링할 수 있어 권장됩니다.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isIOSApp = /SOPT-iOS/.test(navigator.userAgent); // iOS 앱 내 웹뷰 여부
const isIOSApp = typeof navigator !== 'undefined' && /SOPT-iOS/.test(navigator.userAgent); // iOS 앱 내 웹뷰 여부
🤖 Prompt for AI Agents
In src/components/feed/detail/DetailFeedCard.tsx around lines 74-75, the code
directly accesses navigator.userAgent causing a ReferenceError during SSR; guard
the access by checking typeof navigator !== 'undefined' (or typeof window !==
'undefined') before testing the userAgent and default to false on the server so
the expression becomes safe in Node rendering; update the isIOSApp assignment to
perform this typeof check and return a boolean fallback when navigator is
unavailable.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: SOPT iOS앱에서 커뮤니티 상세페이지 이전 버튼 중복되는 이슈 해결

1 participant