From 9ac71920bfaefcbbe2ff0bb3a1d047f399fa5237 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 7 May 2023 18:19:28 +0800 Subject: [PATCH] Additional logic for auto-collapsing comments --- src/pages/status.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/status.jsx b/src/pages/status.jsx index 840d6fe6..58067154 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -986,6 +986,7 @@ function SubComments({ instance, hasParentThread, level, + previousOpen, }) { const [searchParams, setSearchParams] = useSearchParams(); // Set isBrief = true: @@ -1025,7 +1026,9 @@ function SubComments({ .slice(0, 3); const open = - (!hasParentThread || replies.length === 1) && (isBrief || !hasManyStatuses); + !previousOpen && + (!hasParentThread || replies.length === 1) && + (isBrief || !hasManyStatuses); const openBefore = cachedRepliesToggle[replies[0].id]; const handleMediaClick = useCallback((e, i, media, status) => { @@ -1113,6 +1116,7 @@ function SubComments({ hasManyStatuses={hasManyStatuses} replies={r.replies} level={level + 1} + previousOpen={open} /> )}