Skip to content

Add useContextMenuGroups hook #7066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kraenhansen
Copy link
Contributor

@kraenhansen kraenhansen commented Jul 1, 2025

Description

I have a use-case for a component which should be able to add multiple groups of menu items.

Merging this PR will:

  • Refactor the registerItems to take a variable length of arrays of items as arguments.
  • Implement a useContextMenuGroups hook, similar to useContextMenuItems calling into registerItems.

@kraenhansen kraenhansen self-assigned this Jul 1, 2025
@kraenhansen kraenhansen requested a review from a team as a code owner July 1, 2025 07:20
@kraenhansen kraenhansen added the no release notes Fix or feature not for release notes label Jul 1, 2025
@kraenhansen kraenhansen requested review from gagik and removed request for a team July 1, 2025 07:20
Copy link
Contributor

@gagik gagik left a comment

Choose a reason for hiding this comment

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

Nice

@@ -100,3 +103,13 @@ export function useContextMenuItems(
const contextMenu = useContextMenu();
return contextMenu.registerItems(memoizedItems);
}

export function useContextMenuGroups(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You can add useContextMenuGroups to our linter's react-hooks/exhaustive-deps additionalHooks config to track dependencies. If you search for useContextMenuItems you will probably find it

@kraenhansen kraenhansen added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Jul 1, 2025
@kraenhansen kraenhansen force-pushed the kh/use-context-menu-groups-hook branch from cd22a91 to 129f840 Compare July 1, 2025 07:45
@kraenhansen kraenhansen merged commit bcd1cd6 into gagik/context-menu-compass-ui Jul 1, 2025
2 checks passed
@kraenhansen kraenhansen deleted the kh/use-context-menu-groups-hook branch July 1, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no release notes Fix or feature not for release notes no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants