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: strategy targeting numeric also check value field #6774

Merged

Conversation

daveleek
Copy link
Contributor

@daveleek daveleek commented Apr 4, 2024

About the changes

API returns both value and values fields. Empty values array causes ui to think constraint doesnt have a value

This PR checks if value field exists and is empty before returning check on values and length

Discussion points

Included a check on the value of the field in addition to checking if the field exists, I'll check the Open API spec but can we guarantee it doesn't exist without also having a value?
Should we check if the field is undefined? Feels like if it exists it's returned either with a value or as empty.

API returns both value and values fields. Empty values array
causes ui to think constraint doesnt have a value

This commit checks if value field exists and is empty before
returning check on values and length
Copy link

vercel bot commented Apr 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview Apr 4, 2024 8:21am
1 Ignored Deployment
Name Status Preview Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Apr 4, 2024 8:21am

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Declining Code Health: 1 findings(s) 🚩

View detailed results in CodeScene

Comment on lines +21 to +23
if (
constraint.hasOwnProperty('values') &&
(!constraint.hasOwnProperty('value') || constraint.value === '')

Choose a reason for hiding this comment

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

❌ New issue: Complex Conditional
filterConstraints has 1 complex conditionals with 2 branches, threshold = 2

Suppress

@kwasniew kwasniew self-requested a review April 4, 2024 09:38
Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

LGTM

@daveleek daveleek merged commit f29ecaf into main Apr 4, 2024
15 checks passed
@daveleek daveleek deleted the fix/strategy-constraint-numeric-removed-on-change-tab branch April 4, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants