diff --git a/newsfeed/src/components/StoryCommentsSection.tsx b/newsfeed/src/components/StoryCommentsSection.tsx index b564af9b..14aaaaf9 100644 --- a/newsfeed/src/components/StoryCommentsSection.tsx +++ b/newsfeed/src/components/StoryCommentsSection.tsx @@ -3,8 +3,7 @@ import { graphql } from "relay-runtime"; import { useFragment } from "react-relay"; import type { StoryCommentsSectionFragment$key } from "./__generated__/StoryCommentsSectionFragment.graphql"; import Comment from "./Comment"; - -const { useState, useTransition } = React; +import LoadMoreCommentsButton from "./LoadMoreCommentsButton"; export type Props = { story: StoryCommentsSectionFragment$key; @@ -12,27 +11,30 @@ export type Props = { const StoryCommentsSectionFragment = graphql` fragment StoryCommentsSectionFragment on Story { - comments(first: 1) { - pageInfo { - startCursor - } + comments(first: 3) { edges { node { - id ...CommentFragment } } + pageInfo { + hasNextPage + } } } `; export default function StoryCommentsSection({ story }: Props) { const data = useFragment(StoryCommentsSectionFragment, story); + const onLoadMore = () => {/* TODO */}; return ( -
- {data.comments.edges.map((edge) => ( - - ))} -
+ <> + {data.comments.edges.map(commentEdge => + + )} + {data.comments.pageInfo.hasNextPage && ( + + )} + ); }