fix(preprod): Settings button redirect#107488
Conversation
static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx
Outdated
Show resolved
Hide resolved
| <Layout.Title>Builds</Layout.Title> | ||
| <Layout.HeaderActions> | ||
| {projects.length === 1 && ( | ||
| {singleProject && ( |
There was a problem hiding this comment.
Settings button appears when multiple projects selected
Medium Severity
The condition controlling when the Settings button appears changed from projects.length === 1 to just singleProject. Since singleProject is derived from projects[0], it will be truthy whenever any project is selected and exists in the store—even when multiple projects are selected. This causes the Settings button to incorrectly appear and link to only the first project's settings when viewing multiple projects, which wasn't the original behavior.
Additional Locations (1)
83cd543 to
2328427
Compare
static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx
Show resolved
Hide resolved
static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx
Outdated
Show resolved
Hide resolved
2328427 to
191ed5a
Compare
| const projects = Array.from(new Set(projectList.filter(Boolean))); | ||
| const projectId = projects[0]; | ||
| const singleProject = | ||
| projectId === undefined ? undefined : ProjectsStore.getById(projectId); |
There was a problem hiding this comment.
Bug: The code uses ProjectsStore.getById(projectId) to fetch project details, but the projectId variable contains a project slug, not a numeric ID, causing the lookup to fail.
Severity: MEDIUM
Suggested Fix
Replace the call to ProjectsStore.getById(projectId) with ProjectsStore.getBySlug(projectId). This will correctly look up the project using its slug, ensuring the project object is found and related UI components render as expected.
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/views/preprod/buildList/buildList.tsx#L33
Potential issue: The `projectId` variable is derived from the `project` URL query
parameter, which contains the project slug. The code incorrectly attempts to fetch the
project object using `ProjectsStore.getById(projectId)`. Since `getById` expects a
numeric ID, this lookup will always fail and return `undefined`. Consequently, UI
elements like the Settings button in the build list and a LinkButton in the build
details header will not be rendered. Additionally, analytics events will be missing the
`project_slug`.
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.
| size="sm" | ||
| icon={<IconSettings />} | ||
| aria-label={t('Settings')} | ||
| to={`/settings/${organization.slug}/projects/${project?.slug}/mobile-builds/`} |
There was a problem hiding this comment.
Resolves [EME-812 Investigate Sentry settings redirect from build details page](https://linear.app/getsentry/issue/EME-812/investigate-sentry-settings-redirect-from-build-details-page)


Resolves EME-812 Investigate Sentry settings redirect from build details page