fix: replace Array.prototype.at() for broader browser compatibility#3985
fix: replace Array.prototype.at() for broader browser compatibility#3985sentry[bot] wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3985 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 826 826
Lines 15129 15129
Branches 4365 4357 -8
=======================================
Hits 14938 14938
Misses 184 184
Partials 7 7
Continue to review full report in Codecov by Harness.
|
Bundle ReportChanges will increase total bundle size by 53 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: gazebo-production-esmAssets Changed:
Files in
Files in
Files in
view changes for bundle: gazebo-production-systemAssets Changed:
Files in
Files in
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #3985 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 826 826
Lines 15129 15129
Branches 4357 4357
=======================================
Hits 14938 14938
Misses 184 184
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3985 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 826 826
Lines 15129 15129
Branches 4365 4357 -8
=======================================
Hits 14938 14938
Misses 184 184
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 #3985 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 826 826
Lines 15129 15129
Branches 4365 4365
=======================================
Hits 14938 14938
Misses 184 184
Partials 7 7
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Description
This PR addresses a
TypeError: e.at is not a functionoccurring on older iOS Safari versions (e.g., iOS 12.5.8 / Mobile Safari 12.1.2).The root cause was the use of
Array.prototype.at()in several places, which is an ES2022 feature not supported in these older browsers.The fix involves replacing all instances of
Array.prototype.at(-n)with equivalent bracket notation (arr[arr.length - n]) orarr.slice(-1)[0]) to ensure compatibility across a wider range of browsers without introducing polyfills.Code Example
Notable Changes
TypeError: e.at is not a functionencountered on older iOS Safari versions (e.g., iOS 12.5.8 / Mobile Safari 12.1.2).Array.prototype.at(), an ES2022 feature, which is not supported in these older browsers.Array.prototype.at(-n)with compatible alternatives likearr[arr.length - n]orarr.slice(-1)[0].src/shared/ContentsTable/utils/adjustListIfUpDir.tsxsrc/shared/utils/url.tssrc/pages/RepoPage/BundlesTab/BundleContent/AssetsTable/AssetsTable.tsxsrc/pages/RepoPage/CoverageTab/OverviewTab/hooks/useRepoCoverageTimeseries.tsScreenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry 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 Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Fixes GAZEBO-17YX