From ae5cd0ee493c14f2c3d6cc30cfd0e393d46b14f4 Mon Sep 17 00:00:00 2001 From: mkljczk Date: Fri, 7 Mar 2025 11:38:19 +0100 Subject: [PATCH] pl-fe: Fix focused status not reacting to actions on it Signed-off-by: mkljczk --- .../src/features/status/components/thread.tsx | 82 ++++++++----------- 1 file changed, 35 insertions(+), 47 deletions(-) diff --git a/packages/pl-fe/src/features/status/components/thread.tsx b/packages/pl-fe/src/features/status/components/thread.tsx index 21b2c0cfd..b3105c8fc 100644 --- a/packages/pl-fe/src/features/status/components/thread.tsx +++ b/packages/pl-fe/src/features/status/components/thread.tsx @@ -325,59 +325,47 @@ const Thread: React.FC = ({ react: handleHotkeyReact, }; - const children = useMemo(() => { - const focusedStatus = ( -
- {status.deleted ? ( - - ) : ( - -
+ const focusedStatus = ( +
+ {status.deleted ? ( + + ) : ( + +
- + -
+
- -
-
- )} + +
+ + )} - {hasDescendants && ( -
- )} -
- ); + {hasDescendants && ( +
+ )} +
+ ); - const children: JSX.Element[] = []; - - if (isModal) { - // Add padding to the top of the Thread (for Media Modal) - children.push(
); - } - - const renderedAncestors = renderChildren(ancestorsIds); - const renderedDescendants = renderChildren(descendantsIds); - - children.push(...renderedAncestors, focusedStatus, ...renderedDescendants); - - return children; - }, [ancestorsIds, descendantsIds, status.deleted, status.id, isModal]); + const renderedAncestors = useMemo(() => [isModal ?
: null, ...renderChildren(ancestorsIds)], [ancestorsIds]); + const renderedDescendants = useMemo(() => renderChildren(descendantsIds), [descendantsIds]); + const children: (JSX.Element | null)[] = [...renderedAncestors, focusedStatus, ...renderedDescendants]; return (