Basic async pattern
UseuseState for your items and a loading flag, then fetch in a useEffect. Render Command.Loading while the request is in flight:
Determinate progress
Pass aprogress prop (0–100) to Command.Loading to indicate how much has loaded. This sets the aria-valuenow attribute on the underlying progressbar role:
Always-visible items with forceMount
If some items should always be visible regardless of filtering — for example, recent searches shown while loading — useforceMount on those items:
Debouncing search with useCommandState
For search-as-you-type API calls, debounce the query to avoid issuing a request on every keystroke. Read the current search value withuseCommandState:
useCommandState must be called inside a component that is a descendant of Command. It uses useSyncExternalStore internally and re-renders only when the selected slice of state changes.