From dc43040d7ada594e56c4c5d9c9526c3d9536505c Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 29 May 2025 21:39:08 -0500 Subject: [PATCH] Fix read more in linear view --- src/state/queries/usePostThread/index.ts | 2 ++ src/state/queries/usePostThread/traversal.ts | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/state/queries/usePostThread/index.ts b/src/state/queries/usePostThread/index.ts index f52931f040..933881251e 100644 --- a/src/state/queries/usePostThread/index.ts +++ b/src/state/queries/usePostThread/index.ts @@ -79,6 +79,7 @@ export function usePostThread({ hasSession, showMuted: state.shownHiddenReplyKinds.has(HiddenReplyKind.Muted), showHidden: state.shownHiddenReplyKinds.has(HiddenReplyKind.Hidden), + view: params.view, }) }, [ query.data, @@ -86,6 +87,7 @@ export function usePostThread({ moderationOpts, hasSession, state.shownHiddenReplyKinds, + params.view, ]) const mutator = createCacheMutator({ diff --git a/src/state/queries/usePostThread/traversal.ts b/src/state/queries/usePostThread/traversal.ts index e9c92781f1..feceb9dc67 100644 --- a/src/state/queries/usePostThread/traversal.ts +++ b/src/state/queries/usePostThread/traversal.ts @@ -6,6 +6,7 @@ import { import { HiddenReplyKind, + type PostThreadParams, type Slice, type TraversalMetadata, } from '#/state/queries/usePostThread/types' @@ -25,12 +26,14 @@ export function traverse( hasSession, showMuted, showHidden, + view, }: { threadgateHiddenReplies: Set moderationOpts: ModerationOpts hasSession: boolean showMuted: boolean showHidden: boolean + view: PostThreadParams['view'] }, ) { const items: Slice[] = [] @@ -347,11 +350,14 @@ export function traverse( } /* + * Tree-view only. + * * If there's an upcoming parent read more, this branch is part of the * last branch of the sub-tree, and the item itself is the last child, * insert the parent "read more". */ if ( + view === 'tree' && metadata.upcomingParentReadMore && metadata.isPartOfLastBranchFromDepth === metadata.upcomingParentReadMore.depth &&