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

feat: corrected the handling of relativeTime as null in alertHistory #6392

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

SagarRajput-7
Copy link
Contributor

@SagarRajput-7 SagarRajput-7 commented Nov 6, 2024

Summary

Earlier logic had params.get(QueryParams.relativeTime) returning as null but in string i.e. "null" hence the nullish operator added to handle and assign the defaultRelativeValue was not working as expected.

Corrected that and checked string null separately

Related Issues / PR's

Screenshots

Screen.Recording.2024-11-06.at.10.45.13.PM.mov

Affected Areas and Manually Tested Areas

  • tested current behaviour with relativeTime=null and existing behaviours

Copy link

github-actions bot commented Nov 6, 2024

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions github-actions bot added the enhancement New feature or request label Nov 6, 2024
Copy link

github-actions bot commented Nov 6, 2024

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to c8fa90f in 27 seconds

More details
  • Looked at 17 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/pages/AlertDetails/hooks.tsx:63
  • Draft comment:
    The use of ?? RelativeTimeMap['6hr'] is redundant here because relativeTimeParam will never be undefined due to the ternary operation. Consider simplifying this logic.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The ternary operation checks if relativeTimeParam is 'null' and assigns null if true, otherwise assigns relativeTimeParam. The ?? operator is used to provide a default value if the result is null or undefined. The comment suggests redundancy, but the ?? operator is necessary to handle the case where relativeTimeParam is actually null, not just the string 'null'.
    I might be misunderstanding the use of the ?? operator. It is possible that the ?? operator is indeed redundant if relativeTimeParam can never be null or undefined after the ternary operation.
    The ?? operator is used to handle cases where relativeTimeParam is null, which is a valid scenario given the ternary operation. The comment might be incorrect in suggesting redundancy.
    The comment is incorrect because the ?? operator is necessary to handle cases where relativeTimeParam is null. The comment should be deleted.

Workflow ID: wflow_LDUFvbla3jtiVEfS


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

github-actions bot commented Nov 6, 2024

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@SagarRajput-7 SagarRajput-7 merged commit 8403a33 into develop Nov 6, 2024
12 of 18 checks passed
@SagarRajput-7 SagarRajput-7 deleted the alert-history-relativetime-param branch November 6, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs required enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants