From 54a50701a2c9b41191ac3dfa624225704a11ca2f Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 18 Oct 2025 21:03:01 +0000 Subject: [PATCH] Refactor Feed comment handling and pass trending tags to composer cgen-06d108a1ce4a44ef9003101114454363 --- client/pages/Feed.tsx | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/client/pages/Feed.tsx b/client/pages/Feed.tsx index e02326f4..2982c6ca 100644 --- a/client/pages/Feed.tsx +++ b/client/pages/Feed.tsx @@ -243,33 +243,11 @@ export default function Feed() { [toast, user?.id], ); - const handleComment = useCallback( - async (postId: string) => { - if (!user?.id) { - toast({ description: "Please sign in to comment." }); - return; - } - const content = prompt("Add a comment:")?.trim(); - if (!content) return; - try { - const created = await communityService.addComment( - postId, - user.id, - content, - ); - if (created) { - setItems((prev) => - prev.map((it) => - it.id === postId ? { ...it, comments: it.comments + 1 } : it, - ), - ); - } - } catch (e) { - console.warn("Comment failed", e); - } - }, - [toast, user?.id], - ); + const handleComment = useCallback((postId: string) => { + setItems((prev) => + prev.map((it) => (it.id === postId ? { ...it, comments: it.comments + 1 } : it)), + ); + }, []); const filteredItems = useMemo(() => { if (activeFilter === "following") { @@ -472,7 +450,10 @@ export default function Feed() { Compose - fetchFeed()} /> + fetchFeed()} + suggestedTags={trendingTopics.map((t) => t.topic.replace(/^#/, "")).slice(0, 8)} + />