feat(cmdk): Add default limit=4 for async resource actions#112649
feat(cmdk): Add default limit=4 for async resource actions#112649JonasBa wants to merge 3 commits intojb/cmdk/jsx-pocfrom
Conversation
CMDKAction with a resource prop now caps the data passed to its render-prop children at 4 results by default. Callers can override this with the explicit limit prop. Co-Authored-By: Claude <noreply@anthropic.com>
| <CMDKAction display={{label: t('Project Settings'), icon: <IconSettings />}}> | ||
| <CMDKAction | ||
| display={{label: t('Project Settings'), icon: <IconSettings />}} | ||
| limit={4} |
There was a problem hiding this comment.
I haven't gone and applied this to every group because I'm not yet sure that it makes sense, but it would be a trivial change to make if we decide to do it.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b46dbeb. Configure here.
| // cannot appear as independent flat items after the group is processed. | ||
| for (const child of item.children) { | ||
| seen.add(child.key); | ||
| } |
There was a problem hiding this comment.
Nested group limits bypassed in search mode
Medium Severity
The refactored seen set marks child groups as visited when their parent is processed, preventing nested groups from ever applying their own limit. Groups like "Project DSN Keys" (limit={4}, nested inside "DSN") and "Project Settings" (limit={4}, nested inside "Go to...") are skipped in the flatMap because their parent already added them to seen. Their grandchildren then surface as standalone ungrouped items with no limit applied. The old post-pass dedup filter allowed nested groups to independently expand (via the :header key suffix), so this is a behavioral regression.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit b46dbeb. Configure here.
| const results = []; | ||
| for (const index of data) { | ||
| for (const hit of index.hits.slice(0, 3)) { | ||
| for (const hit of index.hits) { |
There was a problem hiding this comment.
Help search per-index cap removed without working replacement
Medium Severity
The index.hits.slice(0, 3) was removed, relying on the implicit default limit=4 for async resources. But "Search Results" is nested inside "Help", so its limit is bypassed in search mode due to the seen set issue. All hits from all Algolia indices (potentially 40+) are now fetched, rendered as child CMDKAction components, and displayed ungrouped in search results—a regression from the previous cap of 3 per index (6 total).
Reviewed by Cursor Bugbot for commit b46dbeb. Configure here.


Adds a
limitprop toCMDKAction(default4) that caps the number of async action results rendered into the lists.Callers that need a different number can pass
limit={n}explicitly.