Skip to content

Commit 0b111ce

Browse files
authored
Merge pull request #481 from velopert/fix/search
fix: handle nullable display_name
2 parents 12f1524 + 4b8c049 commit 0b111ce

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/components/common/FlatPostCard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ const FlatPostCard = ({ post, hideUser }: PostCardProps) => {
170170
/>
171171
</VLink>
172172
<div className="username">
173-
<VLink to={`${velogUrl}`}>{post.user.profile.display_name}</VLink>
173+
<VLink to={`${velogUrl}`}>
174+
{post.user?.profile?.display_name ?? post.user.username}
175+
</VLink>
174176
</div>
175177
</div>
176178
)}

src/components/common/PostCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function PostCard({ post, forHome, forPost }: PostCardProps) {
8383
alt={`user thumbnail of ${post.user.username}`}
8484
/>
8585
<span>
86-
by <b>{post.user.profile.display_name}</b>
86+
by <b>{post.user?.profile?.display_name ?? post.user.username}</b>
8787
</span>
8888
</VLink>
8989
<div className="likes">

0 commit comments

Comments
 (0)