Fix read more in linear view

This commit is contained in:
Eric Bailey
2025-05-29 21:39:08 -05:00
parent e6e1ca3415
commit dc43040d7a
2 changed files with 8 additions and 0 deletions
+2
View File
@@ -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({
@@ -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<string>
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 &&