Skip to content

feat(cmdk): Add default limit=4 for async resource actions#112649

Open
JonasBa wants to merge 3 commits intojb/cmdk/jsx-pocfrom
jb/cmdk/async-limit-prop
Open

feat(cmdk): Add default limit=4 for async resource actions#112649
JonasBa wants to merge 3 commits intojb/cmdk/jsx-pocfrom
jb/cmdk/async-limit-prop

Conversation

@JonasBa
Copy link
Copy Markdown
Member

@JonasBa JonasBa commented Apr 10, 2026

Adds a limit prop to CMDKAction (default 4) that caps the number of async action results rendered into the lists.

Callers that need a different number can pass limit={n} explicitly.

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>
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 10, 2026
@JonasBa JonasBa marked this pull request as ready for review April 10, 2026 05:13
@JonasBa JonasBa requested a review from a team as a code owner April 10, 2026 05:13
<CMDKAction display={{label: t('Project Settings'), icon: <IconSettings />}}>
<CMDKAction
display={{label: t('Project Settings'), icon: <IconSettings />}}
limit={4}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b46dbeb. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant