From f9af2e2de606c5802dd99acfe56c920651c6912b Mon Sep 17 00:00:00 2001 From: Andreas Schultz Date: Thu, 5 Mar 2026 11:39:13 +0100 Subject: [PATCH] Fix conditional hook problem in ActivityControlWidget --- .../ActivityControl/ActivityControlWidget.tsx | 82 +++++++++++-------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/src/cmem/ActivityControl/ActivityControlWidget.tsx b/src/cmem/ActivityControl/ActivityControlWidget.tsx index ec7b3d92..319889e7 100644 --- a/src/cmem/ActivityControl/ActivityControlWidget.tsx +++ b/src/cmem/ActivityControl/ActivityControlWidget.tsx @@ -222,42 +222,11 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) { data-test-id={dataTestIdLegacy ? `${dataTestIdLegacy}-actions` : undefined} > {activityActions && - activityActions.map((action, idx) => { - const actionButtonRef = React.useRef(null); - const ActionButton = () => ( - - ) - return action.notification ? - <> - - - - {actionButtonRef.current && ( - - - - )} - : - - })} + activityActions.map((action, idx) => + )} {additionalActions} {activityContextMenu && activityContextMenu.menuItems.length > 0 && ( {widget} ); } + +interface ActivityActionButtonProps { + action: ActivityControlWidgetAction +} + +const ActivityActionButton = ({action}: ActivityActionButtonProps) => { + const actionButtonRef = React.useRef(null); + const ActionButton = () => ( + + ) + return action.notification ? + <> + + + + {actionButtonRef.current && ( + + + + )} + : + +}