Skip to content

fix(soup): hide disabled context menu items#2185

Merged
evanhutnik merged 5 commits intomainfrom
evan/hide-disabled-menu-items
Mar 25, 2026
Merged

fix(soup): hide disabled context menu items#2185
evanhutnik merged 5 commits intomainfrom
evan/hide-disabled-menu-items

Conversation

@evanhutnik
Copy link
Copy Markdown
Contributor

Summary

  • Disabled context menu actions (right-click menu on soup entities) are now hidden instead of shown greyed out
  • Each MenuItem is wrapped in a SolidJS <Show> conditional so only actionable options appear

Test plan

  • Right-click an email entity in soup view — verify sender-specific actions (Block Sender, etc.) only appear for emails
  • Right-click a document — verify Rename, Copy Branch Name, Share only appear when applicable
  • Multi-select entities — verify menu shows only actions valid for the selection
  • Verify no regressions in action execution

🤖 Generated with Claude Code

Wrap each MenuItem in a <Show> conditional so that actions unavailable
for the selected entity are omitted from the right-click menu entirely,
rather than appearing as disabled/greyed-out entries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@evanhutnik evanhutnik requested a review from a team as a code owner March 25, 2026 19:38
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 26e34a7b-af78-4e8d-9864-c033c29ba920

📥 Commits

Reviewing files that changed from the base of the PR and between 878d7da and e0bce2f.

📒 Files selected for processing (1)
  • js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx

📝 Walkthrough

Summary by CodeRabbit

  • Improvements
    • Actions menu now hides unavailable options instead of showing them disabled, delivering a cleaner, more intuitive set of choices.
    • Menu dividers and sections adjust dynamically based on which action groups are visible for a given item.
    • The Delete action is only shown when it can be executed, removing disabled delete items from the menu.

Walkthrough

SoupEntityActionsMenu now omits ineligible menu items and conditional dividers entirely, replacing previously rendered-but-disabled items with SolidJS <Show> blocks driven by the prior canExecute/canOpen predicates; "Delete" is only rendered when its canExecute check passes.

Changes

Cohort / File(s) Summary
Menu rendering & divider logic
js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx
Menu items ("Mark Done", "Open in new split", "Rename", "Move to folder", "Duplicate", "Copy Link", "Copy Branch Name", "Share", "Block Sender") are wrapped in <Show when={...}> so they are omitted when their predicates fail. "Delete" is rendered only when canExecuteAll(deleteAction.canExecute) is true. Dividers are conditional: the top/middle divider appears only when a top group and a middle-or-delete group exist; an additional divider before the delete section appears only when the delete group and at least one of the top or middle groups are present. Click handlers are unchanged.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format (fix:) and is concise at 43 characters, clearly describing the main change of hiding disabled menu items.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of wrapping MenuItems in SolidJS conditionals and including a relevant test plan.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx`:
- Around line 125-186: The two Divider components are always rendered causing
leading/trailing or consecutive dividers when some action groups are hidden;
compute visibility booleans for each group (e.g., canShowRename =
canExecuteAll(renameAction.canExecute), canShowMove =
canExecuteAny(moveToProjectAction.canExecute), canShowCopy =
canExecuteAny(copyAction.canExecute), canShowCopyLink = props.entities.length
=== 1, canShowCopyBranch = props.entities.length === 1 &&
copyBranchNameAction.canExecute(props.entities[0]), canShowShare =
props.entities.length === 1 && shareAction.canExecute(props.entities[0]),
canShowBlock = canExecuteAll(blockSenderAction.canExecute)) and only render a
Divider when the adjacent groups on both sides are visible (wrap the first
Divider in a conditional that checks if any of the items after it are visible,
and the second Divider only if any items before it are visible) so no orphan or
back-to-back separators are produced; use these booleans in place of the current
unconditional Divider renders and keep existing MenuItem onClick handlers like
handleAction(renameAction.executeWithSoup).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 03be9a56-0894-4ac7-8e84-37b05bb21acd

📥 Commits

Reviewing files that changed from the base of the PR and between 310eae8 and 86492f1.

📒 Files selected for processing (1)
  • js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx (1)

122-183: ⚠️ Potential issue | 🟡 Minor

Guard separators so hidden groups don't leave orphan or back-to-back dividers.

The <Divider /> at lines 122 and 183 are unconditionally rendered. When all items in a group are hidden (e.g., no email entities selected → no "Block Sender", single non-shareable doc → no "Share"), this produces orphan leading/trailing or consecutive dividers.

Compute visibility predicates for each group and wrap dividers accordingly:

💡 Proposed fix
+  const hasTopGroupItems = () =>
+    canExecuteAny(markDone.canExecute) || canOpenInSplit();
+
+  const hasMiddleGroupItems = () =>
+    canExecuteAll(renameAction.canExecute) ||
+    canExecuteAny(moveToProjectAction.canExecute) ||
+    canExecuteAny(copyAction.canExecute) ||
+    props.entities.length === 1 ||
+    canExecuteAll(blockSenderAction.canExecute);
+
+  const hasDeleteItem = () => canExecuteAll(deleteAction.canExecute);

   return (
     <>
       <Show when={canExecuteAny(markDone.canExecute)}>
         ...
       </Show>
       <Show when={canOpenInSplit()}>
         ...
       </Show>

-      <Divider />
+      <Show when={hasTopGroupItems() && hasMiddleGroupItems()}>
+        <Divider />
+      </Show>

       ... middle group items ...

-      <Divider />
+      <Show when={hasMiddleGroupItems() && hasDeleteItem()}>
+        <Divider />
+      </Show>

       <Show when={canExecuteAll(deleteAction.canExecute)}>
         ...
       </Show>
     </>
   );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx`
around lines 122 - 183, The two Divider components are always rendered and can
create orphan or back-to-back dividers when their surrounding MenuItem groups
are all hidden; wrap each Divider in a conditional that checks whether at least
one item in the adjacent group will be shown (e.g., compute predicates using
canExecuteAll/canExecuteAny and per-entity checks such as
renameAction.canExecute, moveToProjectAction.canExecute, copyAction.canExecute,
copyLinkAction (props.entities.length === 1),
copyBranchNameAction.canExecute(props.entities[0]),
shareAction.canExecute(props.entities[0]), blockSenderAction.canExecute) and
only render the Divider when the corresponding groupVisible predicate is true;
update the rendering around the top Divider and the bottom Divider to use those
group visibility predicates instead of unconditional Divider rendering.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx`:
- Around line 122-183: The two Divider components are always rendered and can
create orphan or back-to-back dividers when their surrounding MenuItem groups
are all hidden; wrap each Divider in a conditional that checks whether at least
one item in the adjacent group will be shown (e.g., compute predicates using
canExecuteAll/canExecuteAny and per-entity checks such as
renameAction.canExecute, moveToProjectAction.canExecute, copyAction.canExecute,
copyLinkAction (props.entities.length === 1),
copyBranchNameAction.canExecute(props.entities[0]),
shareAction.canExecute(props.entities[0]), blockSenderAction.canExecute) and
only render the Divider when the corresponding groupVisible predicate is true;
update the rendering around the top Divider and the bottom Divider to use those
group visibility predicates instead of unconditional Divider rendering.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 42b8eae6-2bd9-48b9-90a9-4eaca2228162

📥 Commits

Reviewing files that changed from the base of the PR and between 86492f1 and 1a3020a.

📒 Files selected for processing (1)
  • js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx

@sedson
Copy link
Copy Markdown
Contributor

sedson commented Mar 25, 2026

CleanShot 2026-03-25 at 15 51 00@2x

weird divider at bottom

evanhutnik and others added 2 commits March 25, 2026 15:54
Dividers between action groups are now only rendered when both adjacent
groups have at least one visible item, preventing orphan or consecutive
dividers when action groups are fully hidden.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx`:
- Around line 134-136: The Divider rendering logic can produce two adjacent
dividers; update the second <Show> condition so the Divider only appears when
the middle group is visible (and delete group follows). Locate the second
Divider wrapped in a <Show> that currently uses showTopGroup() ||
showMiddleGroup() (or similar) and change it to require showMiddleGroup() &&
showDeleteGroup(), keeping the first Divider (the one using showTopGroup() &&
(showMiddleGroup() || showDeleteGroup())) unchanged; references: showTopGroup(),
showMiddleGroup(), showDeleteGroup(), and the <Divider /> inside the <Show>
wrapper.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 52417486-5bc1-4ecc-88cc-efa17365b8ff

📥 Commits

Reviewing files that changed from the base of the PR and between 1a3020a and 878d7da.

📒 Files selected for processing (1)
  • js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx

The second divider now only renders when the middle group is visible,
preventing back-to-back dividers when only top and delete groups show.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@evanhutnik evanhutnik merged commit c9de926 into main Mar 25, 2026
22 checks passed
@evanhutnik evanhutnik deleted the evan/hide-disabled-menu-items branch March 25, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants