Skip to content
This repository was archived by the owner on Sep 8, 2023. It is now read-only.

Commit b2b29de

Browse files
committed
[react-threads] Fix hydration error
1 parent a7cd0ca commit b2b29de

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

react-threads/src/components/Thread.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export type ThreadProps = {
9898
thread?: ThreadPost;
9999
};
100100
export const Thread: React.FC<ThreadProps> = ({ thread }) => {
101-
const item = useMemo(() => thread?.thread_items?.find((v) => !!v?.post?.user), []);
101+
const item = useMemo(() => thread?.thread_items?.find((v) => !!v?.post?.user), [thread]);
102102

103103
const reposted_post = item?.post?.text_post_app_info?.share_info?.reposted_post;
104104
// const quoted_post = item?.post.text_post_app_info.share_info.quoted_post;
@@ -128,7 +128,7 @@ export const Thread: React.FC<ThreadProps> = ({ thread }) => {
128128
<div className="grid grid-cols-[48px_minmax(0,1fr)] grid-rows-[36px_0_max-content_max-content]">
129129
<div className="pt-0 row-[1/span_2] col-[1]">
130130
<div className="w-[36px] h-[36px] rounded-full bg-[rgb(30,30,30)] overflow-hidden">
131-
{user?.profile_pic_url && (
131+
{!!user && (
132132
<Image
133133
className="w-full h-full"
134134
alt={user.username}
@@ -186,7 +186,7 @@ export const Thread: React.FC<ThreadProps> = ({ thread }) => {
186186
{nestedPost && (
187187
<div className="border-[0.5px] border-[rgba(243,245,247,0.15)] p-4 mt-4 rounded-[8px]">
188188
<div className="flex items-center w-full">
189-
{nestedPost.user.profile_pic_url && (
189+
{!!nestedPost.user && (
190190
<Image
191191
className="w-[18px] h-[18px] mr-2 rounded-full"
192192
alt={nestedPost.user.username}

0 commit comments

Comments
 (0)