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, hasSession,
showMuted: state.shownHiddenReplyKinds.has(HiddenReplyKind.Muted), showMuted: state.shownHiddenReplyKinds.has(HiddenReplyKind.Muted),
showHidden: state.shownHiddenReplyKinds.has(HiddenReplyKind.Hidden), showHidden: state.shownHiddenReplyKinds.has(HiddenReplyKind.Hidden),
view: params.view,
}) })
}, [ }, [
query.data, query.data,
@@ -86,6 +87,7 @@ export function usePostThread({
moderationOpts, moderationOpts,
hasSession, hasSession,
state.shownHiddenReplyKinds, state.shownHiddenReplyKinds,
params.view,
]) ])
const mutator = createCacheMutator({ const mutator = createCacheMutator({
@@ -6,6 +6,7 @@ import {
import { import {
HiddenReplyKind, HiddenReplyKind,
type PostThreadParams,
type Slice, type Slice,
type TraversalMetadata, type TraversalMetadata,
} from '#/state/queries/usePostThread/types' } from '#/state/queries/usePostThread/types'
@@ -25,12 +26,14 @@ export function traverse(
hasSession, hasSession,
showMuted, showMuted,
showHidden, showHidden,
view,
}: { }: {
threadgateHiddenReplies: Set<string> threadgateHiddenReplies: Set<string>
moderationOpts: ModerationOpts moderationOpts: ModerationOpts
hasSession: boolean hasSession: boolean
showMuted: boolean showMuted: boolean
showHidden: boolean showHidden: boolean
view: PostThreadParams['view']
}, },
) { ) {
const items: Slice[] = [] 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 * 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, * last branch of the sub-tree, and the item itself is the last child,
* insert the parent "read more". * insert the parent "read more".
*/ */
if ( if (
view === 'tree' &&
metadata.upcomingParentReadMore && metadata.upcomingParentReadMore &&
metadata.isPartOfLastBranchFromDepth === metadata.isPartOfLastBranchFromDepth ===
metadata.upcomingParentReadMore.depth && metadata.upcomingParentReadMore.depth &&