Fix modals being unregistered inside command menu (#9155)

Fix modals being unregistered inside command menu
This commit is contained in:
Raphaël Bosi
2024-12-20 10:45:22 +01:00
committed by GitHub
parent 54c4d64ae8
commit a0b5720831
7 changed files with 82 additions and 10 deletions

View File

@ -14,6 +14,7 @@ export type CommandMenuItemProps = {
Icon?: IconComponent;
firstHotKey?: string;
secondHotKey?: string;
shouldCloseCommandMenuOnClick?: boolean;
};
export const CommandMenuItem = ({
@ -24,6 +25,7 @@ export const CommandMenuItem = ({
Icon,
firstHotKey,
secondHotKey,
shouldCloseCommandMenuOnClick,
}: CommandMenuItemProps) => {
const { onItemClick } = useCommandMenu();
@ -40,7 +42,13 @@ export const CommandMenuItem = ({
text={label}
firstHotKey={firstHotKey}
secondHotKey={secondHotKey}
onClick={() => onItemClick(onClick, to)}
onClick={() =>
onItemClick({
shouldCloseCommandMenuOnClick,
onClick,
to,
})
}
isSelected={isSelectedItemId}
/>
);