fix(frontend): Prevent TypeError from null rows in CodeTreeTable subtotal - #4103
sentry[bot] wants to merge 1 commit into
Conversation
Bundle ReportChanges will increase total bundle size by 30 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: gazebo-production-systemAssets Changed:
Files in
view changes for bundle: gazebo-production-esmAssets Changed:
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4103 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15148 +1
Branches 4387 4380 -7
=======================================
+ Hits 14961 14962 +1
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Harness.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #4103 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15148 +1
Branches 4379 4380 +1
=======================================
+ Hits 14961 14962 +1
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4103 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15148 +1
Branches 4387 4388 +1
=======================================
+ Hits 14961 14962 +1
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4103 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15148 +1
Branches 4387 4388 +1
=======================================
+ Hits 14961 14962 +1
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Description
This PR addresses a
TypeError: Cannot read properties of null (reading 'lines')occurring in theCodeTreeTablecomponent, specifically within thecalculateColumnTotalfunction.Problem: The
data.reduceoperation used to calculate column totals (e.g., for 'lines', 'hits') did not account fornullentries within thedataarray. Whilereact-tablecan toleratenullrows during rendering, the reducer would attempt to access properties ofnull, leading to a crash.Root Cause: The
calculateColumnTotalfunction'sreducecallback was missing a null guard. When thedataarray, which can containnullentries (originating from the GraphQL API response for certain repo tree paths), was processed,row[columnId]would throw an error ifrowwasnull.Solution: A defensive null guard (
if (!row) return sum) has been added at the beginning of thereducecallback incalculateColumnTotal. This ensures thatnullrows are gracefully skipped, contributing0to the sum, and preventing theTypeError.Code Example
Notable Changes
Added a defensive null guard (
if (!row) return sum) to thereducecallback within thecalculateColumnTotalfunction in theCodeTreeTablecomponent to preventTypeErrorwhen processingnulldata entries.Screenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
Fixes GAZEBO-16B7
This PR was automatically generated by Sentry. You can adjust this setting at any time.