diff --git a/src/core/client/stream/tabs/Comments/ReplyList/CommentReplyCreatedSubscription.tsx b/src/core/client/stream/tabs/Comments/ReplyList/CommentReplyCreatedSubscription.tsx index df0d78200..4cef25e11 100644 --- a/src/core/client/stream/tabs/Comments/ReplyList/CommentReplyCreatedSubscription.tsx +++ b/src/core/client/stream/tabs/Comments/ReplyList/CommentReplyCreatedSubscription.tsx @@ -69,7 +69,7 @@ const CommentReplyCreatedSubscription = createSubscription( return; } // Comment is just outside our visible depth. - if (depth === 6) { + if (depth === 4) { // Inform last comment in visible tree about the available replies. // This will trigger to show the `Read More of this Conversation` link. const replyCount = parentProxy.getValue("replyCount") || 0; diff --git a/src/core/client/stream/tabs/Comments/ReplyList/ReplyListContainer.tsx b/src/core/client/stream/tabs/Comments/ReplyList/ReplyListContainer.tsx index cc9e727ed..6ab84d1cf 100644 --- a/src/core/client/stream/tabs/Comments/ReplyList/ReplyListContainer.tsx +++ b/src/core/client/stream/tabs/Comments/ReplyList/ReplyListContainer.tsx @@ -18,7 +18,7 @@ import { ReplyListContainer1_settings as SettingsData } from "coral-stream/__gen import { ReplyListContainer1_story as StoryData } from "coral-stream/__generated__/ReplyListContainer1_story.graphql"; import { ReplyListContainer1_viewer as ViewerData } from "coral-stream/__generated__/ReplyListContainer1_viewer.graphql"; import { ReplyListContainer1PaginationQueryVariables } from "coral-stream/__generated__/ReplyListContainer1PaginationQuery.graphql"; -import { ReplyListContainer5_comment as Comment5Data } from "coral-stream/__generated__/ReplyListContainer5_comment.graphql"; +import { ReplyListContainer3_comment as Comment3Data } from "coral-stream/__generated__/ReplyListContainer3_comment.graphql"; import { isPublished } from "../helpers"; import CommentReplyCreatedSubscription from "./CommentReplyCreatedSubscription"; @@ -27,7 +27,7 @@ import ReplyList from "./ReplyList"; import ReplyListViewNewMutation from "./ReplyListViewNewMutation"; type UnpackArray = T extends ReadonlyArray ? U : any; -type ReplyNode5 = UnpackArray["node"]; +type ReplyNode3 = UnpackArray["node"]; interface BaseProps { viewer: ViewerData | null; @@ -135,7 +135,7 @@ export const ReplyListContainer: React.FunctionComponent = props => { ), // ReplyListContainer5 contains replyCount. showConversationLink: - ((edge.node as any) as ReplyNode5).replyCount > 0, + ((edge.node as any) as ReplyNode3).replyCount > 0, })); return ( -> = props => ; +> = props => ; -const ReplyListContainer5 = createReplyListContainer( - 5, +const ReplyListContainer3 = createReplyListContainer( + 3, { viewer: graphql` - fragment ReplyListContainer5_viewer on User { + fragment ReplyListContainer3_viewer on User { ...CommentContainer_viewer ...IgnoredTombstoneOrHideContainer_viewer ...LocalReplyListContainer_viewer } `, settings: graphql` - fragment ReplyListContainer5_settings on Settings { + fragment ReplyListContainer3_settings on Settings { disableCommenting { enabled } @@ -224,7 +224,7 @@ const ReplyListContainer5 = createReplyListContainer( } `, story: graphql` - fragment ReplyListContainer5_story on Story { + fragment ReplyListContainer3_story on Story { isClosed settings { live { @@ -236,9 +236,9 @@ const ReplyListContainer5 = createReplyListContainer( } `, comment: graphql` - fragment ReplyListContainer5_comment on Comment + fragment ReplyListContainer3_comment on Comment @argumentDefinitions( - count: { type: "Int!", defaultValue: 5 } + count: { type: "Int!", defaultValue: 3 } cursor: { type: "Cursor" } orderBy: { type: "COMMENT_SORT!", defaultValue: CREATED_AT_ASC } ) { @@ -264,161 +264,6 @@ const ReplyListContainer5 = createReplyListContainer( } `, }, - graphql` - # Pagination query to be fetched upon calling 'loadMore'. - # Notice that we re-use our fragment, and the shape of this query matches our fragment spec. - query ReplyListContainer5PaginationQuery( - $count: Int! - $cursor: Cursor - $orderBy: COMMENT_SORT! - $commentID: ID! - ) { - comment(id: $commentID) { - ...ReplyListContainer5_comment - @arguments(count: $count, cursor: $cursor, orderBy: $orderBy) - } - } - `, - LastReplyList, - true -); - -const ReplyListContainer4 = createReplyListContainer( - 4, - { - viewer: graphql` - fragment ReplyListContainer4_viewer on User { - ...ReplyListContainer5_viewer - ...CommentContainer_viewer - ...IgnoredTombstoneOrHideContainer_viewer - } - `, - settings: graphql` - fragment ReplyListContainer4_settings on Settings { - disableCommenting { - enabled - } - ...ReplyListContainer5_settings - ...CommentContainer_settings - } - `, - story: graphql` - fragment ReplyListContainer4_story on Story { - isClosed - settings { - live { - enabled - } - } - ...ReplyListContainer5_story - ...CommentContainer_story - } - `, - comment: graphql` - fragment ReplyListContainer4_comment on Comment - @argumentDefinitions( - count: { type: "Int!", defaultValue: 5 } - cursor: { type: "Cursor" } - orderBy: { type: "COMMENT_SORT!", defaultValue: CREATED_AT_ASC } - ) { - id - status - lastViewerAction - replies(first: $count, after: $cursor, orderBy: $orderBy) - @connection(key: "ReplyList_replies") { - viewNewEdges { - cursor - } - edges { - node { - id - enteredLive - ...CommentContainer_comment - ...IgnoredTombstoneOrHideContainer_comment - ...ReplyListContainer5_comment - } - } - } - } - `, - }, - graphql` - # Pagination query to be fetched upon calling 'loadMore'. - # Notice that we re-use our fragment, and the shape of this query matches our fragment spec. - query ReplyListContainer4PaginationQuery( - $count: Int! - $cursor: Cursor - $orderBy: COMMENT_SORT! - $commentID: ID! - ) { - comment(id: $commentID) { - ...ReplyListContainer4_comment - @arguments(count: $count, cursor: $cursor, orderBy: $orderBy) - } - } - `, - ReplyListContainer5 -); - -const ReplyListContainer3 = createReplyListContainer( - 3, - { - viewer: graphql` - fragment ReplyListContainer3_viewer on User { - ...ReplyListContainer4_viewer - ...CommentContainer_viewer - ...IgnoredTombstoneOrHideContainer_viewer - } - `, - settings: graphql` - fragment ReplyListContainer3_settings on Settings { - disableCommenting { - enabled - } - ...ReplyListContainer4_settings - ...CommentContainer_settings - } - `, - story: graphql` - fragment ReplyListContainer3_story on Story { - isClosed - settings { - live { - enabled - } - } - ...ReplyListContainer4_story - ...CommentContainer_story - } - `, - comment: graphql` - fragment ReplyListContainer3_comment on Comment - @argumentDefinitions( - count: { type: "Int!", defaultValue: 5 } - cursor: { type: "Cursor" } - orderBy: { type: "COMMENT_SORT!", defaultValue: CREATED_AT_ASC } - ) { - id - status - lastViewerAction - replies(first: $count, after: $cursor, orderBy: $orderBy) - @connection(key: "ReplyList_replies") { - viewNewEdges { - cursor - } - edges { - node { - id - enteredLive - ...CommentContainer_comment - ...IgnoredTombstoneOrHideContainer_comment - ...ReplyListContainer4_comment - } - } - } - } - `, - }, graphql` # Pagination query to be fetched upon calling 'loadMore'. # Notice that we re-use our fragment, and the shape of this query matches our fragment spec. @@ -434,9 +279,9 @@ const ReplyListContainer3 = createReplyListContainer( } } `, - ReplyListContainer4 + LastReplyList, + true ); - const ReplyListContainer2 = createReplyListContainer( 2, { @@ -471,7 +316,7 @@ const ReplyListContainer2 = createReplyListContainer( comment: graphql` fragment ReplyListContainer2_comment on Comment @argumentDefinitions( - count: { type: "Int!", defaultValue: 5 } + count: { type: "Int!", defaultValue: 3 } cursor: { type: "Cursor" } orderBy: { type: "COMMENT_SORT!", defaultValue: CREATED_AT_ASC } ) { @@ -548,7 +393,7 @@ const ReplyListContainer1 = createReplyListContainer( comment: graphql` fragment ReplyListContainer1_comment on Comment @argumentDefinitions( - count: { type: "Int!", defaultValue: 5 } + count: { type: "Int!", defaultValue: 3 } cursor: { type: "Cursor" } orderBy: { type: "COMMENT_SORT!", defaultValue: CREATED_AT_ASC } ) { diff --git a/src/core/client/stream/tabs/Comments/Stream/AllCommentsTab/AllCommentsTabContainer.tsx b/src/core/client/stream/tabs/Comments/Stream/AllCommentsTab/AllCommentsTabContainer.tsx index 09ac44b21..f68e914dd 100644 --- a/src/core/client/stream/tabs/Comments/Stream/AllCommentsTab/AllCommentsTabContainer.tsx +++ b/src/core/client/stream/tabs/Comments/Stream/AllCommentsTab/AllCommentsTabContainer.tsx @@ -105,7 +105,7 @@ export const AllCommentsTabContainer: FunctionComponent = props => { props.relay.hasMore(), props.story.settings.live.enabled, ]); - const [loadMore, isLoadingMore] = useLoadMore(props.relay, 10); + const [loadMore, isLoadingMore] = useLoadMore(props.relay, 20); const beginLoadMoreEvent = useViewerNetworkEvent(LoadMoreAllCommentsEvent); const loadMoreAndEmit = useCallback(async () => { const loadMoreEvent = beginLoadMoreEvent({ storyID: props.story.id }); @@ -219,7 +219,7 @@ const enhanced = withPaginationContainer< story: graphql` fragment AllCommentsTabContainer_story on Story @argumentDefinitions( - count: { type: "Int!", defaultValue: 5 } + count: { type: "Int!", defaultValue: 20 } cursor: { type: "Cursor" } orderBy: { type: "COMMENT_SORT!", defaultValue: CREATED_AT_DESC } ) { diff --git a/src/core/client/stream/test/comments/stream/__snapshots__/postLocalReply.spec.tsx.snap b/src/core/client/stream/test/comments/stream/__snapshots__/postLocalReply.spec.tsx.snap index 1b34daf7e..2b816b27e 100644 --- a/src/core/client/stream/test/comments/stream/__snapshots__/postLocalReply.spec.tsx.snap +++ b/src/core/client/stream/test/comments/stream/__snapshots__/postLocalReply.spec.tsx.snap @@ -3,7 +3,7 @@ exports[`post a reply: open reply form 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-
- - -
-
-
- -
-
-
-
-
-
-
-
- - -   - - - In reply to - - Markus - - -
-
-
-
-
-
- - -
- - -
-
-
-
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - -
-
-
- -
-
-
-
-
-
-
-
- - -   - - - In reply to - - Markus - - -
-
-
-
-
-
- - -
- - -
-
-
-
- - -
-
-
- - Read More of this Conversation > - -
-
-
-
+ Read More of this Conversation > +
diff --git a/src/core/client/stream/test/comments/stream/__snapshots__/showConversation.spec.tsx.snap b/src/core/client/stream/test/comments/stream/__snapshots__/showConversation.spec.tsx.snap index 0b1f1601f..020f54b54 100644 --- a/src/core/client/stream/test/comments/stream/__snapshots__/showConversation.spec.tsx.snap +++ b/src/core/client/stream/test/comments/stream/__snapshots__/showConversation.spec.tsx.snap @@ -3,7 +3,7 @@ exports[`renders deepest comment with link 1`] = `