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

refactor(ui): simplify hasArtifactLogs with optional chaining #12933

Merged

Conversation

agilgur5
Copy link
Member

Similar to other PRs I've had that simplify code or fix bugs by using optional chaining

Motivation

  • remove 4 LoC with optional chaining short-hand

Modifications

  • replace conditionals with optional chaining
  • array.findIndex(...) !== -1 is also equivalent to array.some(...)

Verification

These are semantically equivalent, but I also had this in my local codebase while writing & debugging #12932 et al (which is how I stumbled upon this) and it worked the same

- remove 4 LoC with optional chaining short-hand
- `array.findIndex(...) !== -1` is also equivalent to `array.some(...)`

Signed-off-by: Anton Gilgur <[email protected]>
Copy link
Member

@tczhao tczhao left a comment

Choose a reason for hiding this comment

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

👍 some semantics is clearly more readable than findIndex

Copy link
Member

@isubasinghe isubasinghe left a comment

Choose a reason for hiding this comment

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

LGTM

@isubasinghe isubasinghe merged commit 4319608 into argoproj:main Apr 16, 2024
15 checks passed
@agilgur5 agilgur5 deleted the refactor-ui-simplify-hasArtifactLogs branch April 16, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants