Skip to content

Commit

Permalink
Fix comment threads being collapsed with collapse comment threads on (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding authored Jul 2, 2023
1 parent 23e7c46 commit 7d96ed4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/features/comment/Comments.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React, { useEffect, useMemo, useRef, useState } from "react";
import { buildCommentsTree } from "../../helpers/lemmy";
import {
MAX_DEFAULT_COMMENT_DEPTH,
buildCommentsTree,
} from "../../helpers/lemmy";
import CommentTree from "./CommentTree";
import {
IonRefresher,
Expand Down Expand Up @@ -85,6 +88,7 @@ export default function Comments({
+commentPath.split(".").pop()!
: undefined;
const commentId = commentPath ? +commentPath.split(".")[1] : undefined;
const commentDepth = commentPath ? commentPath.split(".").length : undefined;

const virtuosoRef = useRef<VirtuosoHandle>(null);

Expand Down Expand Up @@ -118,7 +122,12 @@ export default function Comments({
limit: 10,
sort,
type_: "All",
max_depth: defaultCommentDepth,

// Viewing a single thread should always show highlighted comment, regardless of depth
max_depth: commentDepth
? Math.max(MAX_DEFAULT_COMMENT_DEPTH, commentDepth)
: defaultCommentDepth,

saved_only: false,
page: currentPage,
auth: jwt,
Expand Down

0 comments on commit 7d96ed4

Please sign in to comment.