Skip to content

feat(cmdk): add project settings actions#113828

Merged
JonasBa merged 11 commits intomasterfrom
jb/cmdk/project-settings-actions
Apr 23, 2026
Merged

feat(cmdk): add project settings actions#113828
JonasBa merged 11 commits intomasterfrom
jb/cmdk/project-settings-actions

Conversation

@JonasBa
Copy link
Copy Markdown
Member

@JonasBa JonasBa commented Apr 23, 2026

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

JonasBa and others added 8 commits April 20, 2026 20:48
…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>
@JonasBa JonasBa requested a review from a team as a code owner April 23, 2026 17:58
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 23, 2026
Comment thread static/app/components/commandPalette/ui/commandPaletteGlobalActions.tsx Outdated
JonasBa and others added 2 commits April 23, 2026 11:23
…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.
Comment thread static/app/components/commandPalette/ui/commandPaletteGlobalActions.tsx Outdated
Copy link
Copy Markdown
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Looks great!

/**
* Additional search keywords for this item (e.g. aliases or common abbreviations).
*/
keywords?: string[];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good addition

…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>
Comment on lines +423 to +433
],
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}`,
})),
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.

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.

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.

Let me fix this in a followup since this is getting large

@JonasBa JonasBa enabled auto-merge (squash) April 23, 2026 20:37
@JonasBa JonasBa merged commit 237564e into master Apr 23, 2026
65 checks passed
@JonasBa JonasBa deleted the jb/cmdk/project-settings-actions branch April 23, 2026 20:41
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 1 potential issue.

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 8ef17ae. Configure here.

}}
to={`/settings/${organization.slug}/projects/${project.slug}/${suffix}`}
/>
))}
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.

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

Reviewed by Cursor Bugbot for commit 8ef17ae. 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.

3 participants