[Hotfix] SnsLinkIcons 컴포넌트에서 apiSocialLinks가 없을 경우 null 반환 추가#414
Conversation
Walkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant ParentComponent
participant SnsLinkIcons
ParentComponent->>SnsLinkIcons: apiSocialLinks 전달
alt apiSocialLinks가 falsy
SnsLinkIcons-->>ParentComponent: null 반환 (렌더링 없음)
else apiSocialLinks가 truthy
SnsLinkIcons->>SnsLinkIcons: 기존 렌더링 로직 실행
end
Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for moadong ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the SnsLinkIcons component by ensuring that when no social link data is provided, the component returns null to prevent rendering errors.
- Added an early return to check for a falsy apiSocialLinks.
- Prevents the component from rendering when the expected social link data is missing.
| } | ||
|
|
||
| const SnsLinkIcons = ({ apiSocialLinks }: SnsLinkIconsProps) => { | ||
| if (!apiSocialLinks) return null; |
There was a problem hiding this comment.
Consider adding a brief comment explaining why returning null is preferred when apiSocialLinks is falsy to aid future maintainers.
#️⃣연관된 이슈
📝작업 내용
SnsLinkIcons컴포넌트에서apiSocialLinks가undefined또는null일 때 발생하는TypeError를 방어 처리했습니다.apiSocialLinks가 없을 경우 컴포넌트가 렌더링되지 않도록if (!apiSocialLinks) return null;구문을 추가해 배포 시 상세페이지 크래시 문제를 해결했습니다.