Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function useOrganizationReleases({
: '',
crash_free_sessions: release.projects[0]?.healthData?.crashFreeSessions ?? 0,
sessions: release.projects[0]?.healthData?.totalSessions ?? 0,
error_count: release.newGroups ?? 0,
error_count: release.projects[0]?.newGroups ?? 0,
project_id: release.projects[0]?.id ?? 0,
adoption: release.projects[0]?.healthData?.adoption ?? 0,
status: release.status,
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/releases/drawer/releasesDrawerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function ReleasesDrawerTable({
project: d.projects[0]!,
release: d.version,
date: d.dateCreated,
error_count: d.newGroups ?? 0,
error_count: d.projects[0]?.newGroups ?? 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Inconsistent Null Handling in Project Mapping

The recent update to error_count introduced inconsistent null handling for projects[0]. Within the same object mapping, projects[0] is accessed with a non-null assertion (!) for the project field, but with optional chaining (?.) for error_count. If projects[0] is null, this can lead to a runtime error, despite error_count safely returning 0. This pattern appears in both releasesDrawerTable.tsx and useOrganizationReleases.tsx.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

project_id: d.projects[0]?.id ?? 0,
}));

Expand Down
2 changes: 0 additions & 2 deletions static/app/views/releases/list/releaseCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function ReleaseCard({
dateCreated,
versionInfo,
adoptionStages,
newGroups,
projects,
} = release;

Expand Down Expand Up @@ -268,7 +267,6 @@ function ReleaseCard({
location={location}
organization={organization}
project={project}
newGroups={newGroups}
releaseVersion={version}
showPlaceholders={showHealthPlaceholders}
showReleaseAdoptionStages={showReleaseAdoptionStages}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ type Props = {
index: number;
isTopRelease: boolean;
location: Location;
newGroups: number;
organization: Organization;
project: ReleaseProject;
releaseVersion: string;
Expand All @@ -86,10 +85,9 @@ function ReleaseCardProjectRow({
releaseVersion,
showPlaceholders,
showReleaseAdoptionStages,
newGroups,
}: Props) {
const theme = useTheme();
const {id} = project;
const {id, newGroups} = project;

const crashCount = getHealthData.getCrashCount(
releaseVersion,
Expand Down
Loading