Skip to content

fix(apollo-react): disable task three-dot menu while loading [MST-8171]#471

Open
KodudulaAshishUiPath wants to merge 1 commit intomainfrom
fix/MST-8171
Open

fix(apollo-react): disable task three-dot menu while loading [MST-8171]#471
KodudulaAshishUiPath wants to merge 1 commit intomainfrom
fix/MST-8171

Conversation

@KodudulaAshishUiPath
Copy link
Copy Markdown
Contributor

@KodudulaAshishUiPath KodudulaAshishUiPath commented Apr 8, 2026

Summary

  • Add loadingTaskIds prop to StageNode to track which tasks are currently loading
  • Disable three-dot menu button on tasks that are in a loading state (prevents delete/actions during async operations)
  • Apply same treatment to adhoc tasks
  • Replace addTaskLoading with loadingTaskIds for per-task granularity
  • Update tests and stories

Demo

Screen.Recording.2026-04-08.at.15.04.57.mov

Test plan

  • Verify three-dot menu button is disabled (greyed out) on loading tasks in storybook (AddTaskLoading story, third stage)
  • Verify three-dot menu button is enabled on non-loading tasks in the same stage
  • Verify right-click context menu is suppressed on loading tasks
  • Verify loading state clears and menu re-enables after async operation completes
  • Run DraggableTask.test.tsx — 4 new tests for loading state behavior
  • Run StageNode.test.tsx — updated tests use loadingTaskIds instead of addTaskLoading

Copilot AI review requested due to automatic review settings April 8, 2026 09:38
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (PT)
apollo-canvas 🟢 Ready Preview, Logs Apr 08, 2026, 04:34:35 AM
apollo-landing 🟢 Ready Preview, Logs Apr 08, 2026, 04:32:33 AM
apollo-ui-react 🟢 Ready Preview, Logs Apr 08, 2026, 04:33:48 AM
apollo-vertex 🟢 Ready Preview, Logs Apr 08, 2026, 04:33:48 AM
apollo-wind 🟢 Ready Preview, Logs Apr 08, 2026, 04:32:32 AM

@github-actions github-actions bot added the size:L 100-499 changed lines. label Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Dependency License Review

  • 1940 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 3 package(s) excluded (see details below)
License distribution
License Packages
MIT 1700
ISC 89
Apache-2.0 61
BSD-3-Clause 28
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 5
MIT OR Apache-2.0 3
MIT-0 3
CC0-1.0 3
LGPL-3.0-or-later 2
(MIT OR Apache-2.0) 2
Unlicense 2
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.2.4 LGPL-3.0-or-later LGPL pre-built binary, not linked
@img/sharp-libvips-linuxmusl-x64 1.2.4 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the StageNode task-loading model to support per-task loading state and uses it to suppress task menus/actions while async operations are in progress.

Changes:

  • Introduces loadingTaskIds on StageNode and wires it through to task renderers.
  • Disables the task “three-dot” menu button and suppresses right-click context menus for loading tasks (including adhoc tasks).
  • Updates StageNode/DraggableTask tests and stories to reflect the new loading-state behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/apollo-react/src/canvas/components/StageNode/TaskMenu.tsx Adds disabled prop and blocks menu open via click/contextmenu when disabled.
packages/apollo-react/src/canvas/components/StageNode/StageNode.types.ts Replaces addTaskLoading with loadingTaskIds in public props.
packages/apollo-react/src/canvas/components/StageNode/StageNode.tsx Computes loading state and passes per-task loading flag down to task components; uses loading to disable add-task UX/toolbox.
packages/apollo-react/src/canvas/components/StageNode/StageNode.test.tsx Updates loading-related tests to use loadingTaskIds.
packages/apollo-react/src/canvas/components/StageNode/StageNode.stories.tsx Updates “AddTaskLoading” story and adds a per-task loading demo stage.
packages/apollo-react/src/canvas/components/StageNode/DraggableTask.types.ts Adds isTaskLoading prop.
packages/apollo-react/src/canvas/components/StageNode/DraggableTask.tsx Disables menu + suppresses right-click context menu when loading.
packages/apollo-react/src/canvas/components/StageNode/DraggableTask.test.tsx Adds tests around loading-state menu behavior.
packages/apollo-react/src/canvas/components/StageNode/AdhocTask.tsx Applies the same loading-state menu suppression to adhoc tasks.

Comment on lines 58 to 63
headerChips?: StageHeaderChip[];
};
addTaskLabel?: string;
addTaskLoading?: boolean;
replaceTaskLabel?: string;
taskOptions?: ListItem[];
execution?: {
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StageNodeBaseProps removes the previously public addTaskLoading prop, which is a breaking API change for external consumers. Consider keeping addTaskLoading?: boolean as a deprecated alias (mapping it to loadingTaskIds/isAnyTaskLoading) for at least one release, or document/major-bump appropriately.

Copilot uses AI. Check for mistakes.
onReplaceTaskFromToolbox?: (newTask: ListItem, groupIndex: number, taskIndex: number) => void;
onTaskPlay?: (taskId: string) => Promise<void>;
hideParallelOptions?: boolean;
loadingTaskIds?: Set<string>;
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadingTaskIds is typed as a mutable Set<string>. In React props, mutating a Set in-place can change .size/.has() results without triggering a re-render, leading to stale UI. Prefer ReadonlySet<string> (and treat it immutably by replacing the instance when it changes).

Suggested change
loadingTaskIds?: Set<string>;
loadingTaskIds?: ReadonlySet<string>;

Copilot uses AI. Check for mistakes.
className="task-menu-icon-button"
sx={{
color: 'var(--colorIconDefault) !important',
color: disabled ? 'var(--colorIconDisabled) !important' : 'var(--colorIconDefault) !important',
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The disabled color uses var(--colorIconDisabled), but this CSS variable doesn’t appear to be defined in the repo (and the existing canvas variables use kebab-case like --color-icon-default). This can result in an incorrect icon color; consider relying on the built-in disabled styling for ApIconButton or switching to an existing, defined CSS variable.

Suggested change
color: disabled ? 'var(--colorIconDisabled) !important' : 'var(--colorIconDefault) !important',

Copilot uses AI. Check for mistakes.
Comment on lines +401 to +416
it('does not attach onContextMenu when isTaskLoading is true', () => {
const onRemove = vi.fn();
const menuItems = createMenuItems(onRemove);

render(
<DraggableTask
{...defaultProps}
getContextMenuItems={() => menuItems}
isTaskLoading={true}
/>
);

const task = screen.getByTestId('stage-task-task-1');
// onContextMenu should not be set — right-click should not open menu
expect(task.oncontextmenu).toBeNull();
});
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not asserting what it intends: React event handlers are attached via event delegation, so element.oncontextmenu will typically remain null even when an onContextMenu prop is present. To verify right-click is suppressed when loading, fire a contextMenu event and assert the menu does not open (or that the handler is not invoked via a spy).

Copilot uses AI. Check for mistakes.
Comment on lines 107 to 125
<StageTask
ref={taskRef}
data-testid={`stage-task-${task.id}`}
selected={isSelected}
status={taskExecution?.status}
onClick={handleClick}
{...(getContextMenuItems && { onContextMenu: handleContextMenu })}
{...(getContextMenuItems && !isTaskLoading && { onContextMenu: handleContextMenu })}
>
<TaskContent task={task} taskExecution={taskExecution} />
{onTaskPlay && <AdhocTaskPlayButton taskId={task.id} onTaskPlay={onTaskPlay} />}
{getContextMenuItems && (
<TaskMenu
ref={menuRef}
taskId={task.id}
getContextMenuItems={getContextMenuItems}
onMenuOpenChange={handleMenuOpenChange}
taskRef={taskRef}
disabled={isTaskLoading}
/>
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading-state behavior was added for adhoc tasks (isTaskLoading disables the 3-dot menu and suppresses right-click), but there are no corresponding assertions in the existing AdhocTaskItem tests. Please add unit tests covering disabled menu button and context-menu suppression for adhoc tasks.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines 649 to 653
it('should pass loadingTaskIds to Toolbox when toolbox is open', async () => {
const user = userEvent.setup();
const onAddTaskFromToolbox = vi.fn();
const { rerender } = renderStageNode({ onAddTaskFromToolbox, addTaskLoading: false });
const { rerender } = renderStageNode({ onAddTaskFromToolbox, loadingTaskIds: new Set() });

Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test name is misleading: the component doesn’t pass loadingTaskIds to Toolbox; it derives a boolean loading from it. Consider renaming this test to reflect the actual behavior being asserted (e.g., Toolbox loading becomes true when loadingTaskIds is non-empty).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants