import type { ComponentProps, ReactNode } from 'react' import { cn, CommandItem } from 'ui' import { DynamicLink, type DynamicLinkProps } from '@/components/ui/DynamicLink' export interface CommandItemLinkProps extends Omit, 'children'> { href: string linkProps?: Omit children: ReactNode } /** * A command item that navigates with native link behaviour. * * The link must wrap the command item. Nesting a link inside a command item can * unmount the link when selection closes its menu before navigation completes. */ export function CommandItemLink({ href, linkProps, children, disabled, ...commandItemProps }: CommandItemLinkProps) { const commandItem = ( {children} ) if (disabled) return commandItem return ( {commandItem} ) }