feat(cmdk): add project settings actions#113828
Conversation
…t picker Replace the flat projects list under Project Settings with one entry per settings page. Selecting a page prompts the user to pick a project, then navigates directly to that page for the chosen project. This avoids rendering n×m palette entries (projects × settings pages) for large orgs by fetching projects lazily only when a specific settings page is selected. The settings page list is derived from getNavigationConfiguration so it stays in sync with the sidebar automatically. Also fixes an empty-state flash that appeared while a prompt action's async resource was loading, and extends NavigationItem with an optional keywords field (used to alias Client Keys as 'dsn'). Co-Authored-By: Claude <noreply@anthropic.com>
When the user is on a route with a :projectId param, render that project as the first option in project settings command palette actions. Uses the same static-child-first pattern as the "assign to me" action so the current project appears before the async resource results. Also adds tests covering the ordering behavior, deduplication, and the no-priority case when not on a project route. Co-Authored-By: Claude <noreply@anthropic.com>
When the user is on a project settings page (params.projectId) or has a project selected via ?project= query param, the matching project(s) are surfaced at the top of each project settings nav section's selector with a 'Current' badge and a combined label (e.g. 'project-b · General Settings'). Multiple selected query-param projects are all pinned. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
- Replace Projects submenu with a direct link to all projects, using IconAllProjects - Move Settings above Projects in the action order - Use project slug as label for current project in Project Settings actions - Merge ReactNode import into Fragment import line Co-Authored-By: Claude <noreply@anthropic.com>
Wrap the getNavigationConfiguration call in useMemo to avoid recomputing the nav item list on every render. Depends on organization which only changes when org data changes. Co-Authored-By: Claude <noreply@anthropic.com>
…labels The previous simplification commit changed the current-project label from '%s · %s' (slug + nav item title) to just the project slug, and changed the outer section label from 'Project Settings' to project.slug. Update the affected test assertions to match the new behavior.
| /** | ||
| * Additional search keywords for this item (e.g. aliases or common abbreviations). | ||
| */ | ||
| keywords?: string[]; |
…d palette The show filter for project settings nav items was calling show functions with no arguments, but NavigationItem.show expects a NavigationGroupProps object. Any show function checking opts.access (e.g. the plugin deprecation guard) would silently receive undefined and evaluate to falsy, hiding the nav item incorrectly. Build a context with access, features, and organization from the current org and spread it with the section, matching the pattern already used in projectSettingsCommandPaletteActions.tsx. Also fix a prior bug where show: false was conflated with show: undefined, incorrectly including explicitly-hidden items. Co-Authored-By: Claude <noreply@anthropic.com>
| ], | ||
| queryFn: () => | ||
| projects | ||
| .filter(p => !currentProjectSlugs.has(p.slug)) | ||
| .map(project => ({ | ||
| display: { | ||
| label: project.slug, | ||
| icon: <ProjectAvatar project={project} size={16} />, | ||
| }, | ||
| to: `/settings/${organization.slug}/projects/${project.slug}/${suffix}`, | ||
| })), |
There was a problem hiding this comment.
Bug: The command palette's project settings query uses an infinite staleTime but doesn't invalidate its cache when projects are created or deleted, leading to a stale project list.
Severity: MEDIUM
Suggested Fix
Add an explicit cache invalidation call, such as queryClient.invalidateQueries(), for the ['project-settings', ...] query key when the ProjectsStore is updated (e.g., on project creation or deletion). This will ensure the command palette refetches the project list and displays fresh data.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location:
static/app/components/commandPalette/ui/commandPaletteGlobalActions.tsx#L423-L433
Potential issue: The project settings resource query for the command palette uses
`staleTime: Infinity` with a `queryKey` that intentionally omits the `projects` list for
performance. However, the `queryFn` directly filters the `projects` array. When a
project is created or deleted, the `ProjectsStore` is updated, but there is no
corresponding invalidation for this query. Because the cache is set to never be stale,
users will see an outdated list of projects in the command palette until they manually
switch projects (which changes the `queryKey`) or perform a full page refresh.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Let me fix this in a followup since this is getting large
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8ef17ae. Configure here.
| }} | ||
| to={`/settings/${organization.slug}/projects/${project.slug}/${suffix}`} | ||
| /> | ||
| ))} |
There was a problem hiding this comment.
React key collision between static children and resource nodes
Medium Severity
Static children rendered via currentProjects.map use key={project.id} (string numbers like "1", "2", "3"), while resolvedResourceNodes in cmdk.tsx uses key={i} (numeric indices 0, 1, 2, …). Both sets are rendered as siblings inside the same CMDKCollection.Context.Provider. React coerces keys to strings, so key={1} and key={"1"} collide. For any org with a few projects, resource index values will overlap with current project IDs, causing React to incorrectly reconcile components — the current-project entry could disappear or display the wrong project's data.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8ef17ae. Configure here.


Adds project settings actions with detection for currently selected project (via qs and route params)