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

fix(ui): handle undefined dates in Workflows List filter #11792

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

agilgur5
Copy link
Member

@agilgur5 agilgur5 commented Sep 10, 2023

Another fix for #9696

Motivation

  • when date filters are removed, they are set to undefined
    • the previous logic did not handle this correctly, comparing undefined with Dates
      • comparing to undefined always returns false
    • new logic only compares when Dates are set

Modifications

  • only compare the Dates when they are actually set, otherwise return true

Verification

Can see in the below screenshot (in React DevTools) that minStartedAt was set to undefined after I hit the "x" button on the date filter:

Screenshot 2023-09-10 at 12 10 20 AM

Made sure that undefined did in fact act weirdly, and here's results from browser console REPL:

undefined < new Date()
// false
undefined > new Date()
// false
new Date() > undefined
// false
new Date() < undefined
// false

Tested manually in the UI and made sure it works as expected

- when date filters are removed, they are set to undefined
  - the previous logic did not handle this correctly, comparing `undefined` with Dates
    - comparing to `undefined` _always_ returns `false`
  - new logic only compares when Dates are set

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
@terrytangyuan terrytangyuan merged commit 7e62657 into argoproj:master Sep 11, 2023
25 checks passed
@agilgur5 agilgur5 deleted the fix-ui-handle-null-dates branch September 11, 2023 04:23
terrytangyuan pushed a commit that referenced this pull request Oct 19, 2023
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
dpadhiar pushed a commit to dpadhiar/argo-workflows that referenced this pull request May 9, 2024
…11792)

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
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

2 participants