Slightly rewritten collapsing logic

Let's see if this works better
This commit is contained in:
Lim Chee Aun 2023-05-08 12:50:00 +08:00
parent 437c50eeb5
commit 02d26b8da2

View file

@ -1025,10 +1025,17 @@ function SubComments({
.filter((a, i, arr) => arr.findIndex((b) => b.id === a.id) === i) .filter((a, i, arr) => arr.findIndex((b) => b.id === a.id) === i)
.slice(0, 3); .slice(0, 3);
const open = let open = false;
!previousOpen && // const open =
(!hasParentThread || replies.length === 1) && // !previousOpen &&
(isBrief || !hasManyStatuses); // (!hasParentThread || totalComments === 1) &&
// (isBrief || !hasManyStatuses);
if (hasParentThread) {
open = totalComments === 1;
} else {
open = isBrief;
}
if (!previousOpen && !open) open = true;
const openBefore = cachedRepliesToggle[replies[0].id]; const openBefore = cachedRepliesToggle[replies[0].id];
const handleMediaClick = useCallback((e, i, media, status) => { const handleMediaClick = useCallback((e, i, media, status) => {