Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eas-cli] fix formatFields to handle empty array #2914

Merged
merged 2 commits into from
Feb 24, 2025

Conversation

quinlanj
Copy link
Member

@quinlanj quinlanj commented Feb 21, 2025

Why

When formatting fields with an empty array, the code would attempt to find the maximum label length, causing an error when reducing an empty array (Reduce of empty array with no initial value). This needs to be fixed to handle empty arrays gracefully.

How

Added an early return statement that checks if the input fields array is empty, returning an empty string before attempting to calculate the column width.

Test Plan

  • Ran into the empty array case by running EXPO_STAGING=1 ~/Documents/eas-cli/packages/eas-cli/bin/run fingerprint:compare 796b89315aeaa4b466aa3ac6c2dcff5cf9ed4c8e d5de1b929c0346251e400eed13205fda4eaf51bf

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

github-actions bot commented Feb 21, 2025

Size Change: -186 B (0%)

Total Size: 53.5 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 53.5 MB -186 B (0%)

compressed-size-action

Copy link

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 52.63%. Comparing base (4b8a9d1) to head (602ae14).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/eas-cli/src/utils/formatFields.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2914      +/-   ##
==========================================
- Coverage   52.63%   52.63%   -0.00%     
==========================================
  Files         588      588              
  Lines       23200    23202       +2     
  Branches     4859     4860       +1     
==========================================
+ Hits        12210    12211       +1     
- Misses      10021    10022       +1     
  Partials      969      969              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@quinlanj quinlanj requested a review from szdziedzic February 21, 2025 21:27
@quinlanj quinlanj marked this pull request as ready for review February 21, 2025 21:28
Copy link

Subscribed to pull request

File Patterns Mentions
**/* @szdziedzic, @khamilowicz, @sjchmiela, @radoslawkrzemien

Generated by CodeMention

@quinlanj quinlanj force-pushed the 02-21-_eas-cli_fix_formatfields_to_handle_empty_array branch from 6bfb27b to 602ae14 Compare February 24, 2025 19:40
Copy link

✅ Thank you for adding the changelog entry!

@quinlanj quinlanj merged commit 3ac6472 into main Feb 24, 2025
11 checks passed
@quinlanj quinlanj deleted the 02-21-_eas-cli_fix_formatfields_to_handle_empty_array branch February 24, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants