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

@ -216,8 +216,21 @@ export const useCommandMenu = () => {
);
const onItemClick = useCallback(
(onClick?: () => void, to?: string) => {
toggleCommandMenu();
({
shouldCloseCommandMenuOnClick,
onClick,
to,
}: {
shouldCloseCommandMenuOnClick?: boolean;
onClick?: () => void;
to?: string;
}) => {
if (
isDefined(shouldCloseCommandMenuOnClick) &&
shouldCloseCommandMenuOnClick
) {
toggleCommandMenu();
}
if (isDefined(onClick)) {
onClick();