1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

fix: strategy targeting numeric also check value field (#6774)

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
This commit is contained in:
David Leek 2024-04-04 11:48:51 +02:00 committed by GitHub
parent 99a32a4265
commit f29ecaf3c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,7 +18,10 @@ interface IFeatureStrategyConstraintsProps {
}
const filterConstraints = (constraint: any) => {
if (constraint.hasOwnProperty('values')) {
if (
constraint.hasOwnProperty('values') &&
(!constraint.hasOwnProperty('value') || constraint.value === '')
) {
return constraint.values && constraint.values.length > 0;
}