Skip to content

Commit

Permalink
fix: Filter string is erased when changing filter condition (#2586)
Browse files Browse the repository at this point in the history
  • Loading branch information
vardhan0604 authored Aug 7, 2024
1 parent 9f1afda commit 6fa2c8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Filter/Filter.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function changeField(schema, currentClassName, filters, index, newField) {
return filters.set(index, newFilter);
}

function changeConstraint(schema, currentClassName, filters, index, newConstraint) {
function changeConstraint(schema, currentClassName, filters, index, newConstraint, prevCompareTo) {
const field = filters.get(index).get('field');
let compareType = schema[currentClassName][field].type;
if (Object.prototype.hasOwnProperty.call(Filters.Constraints[newConstraint], 'field')) {
Expand All @@ -61,7 +61,7 @@ function changeConstraint(schema, currentClassName, filters, index, newConstrain
class: currentClassName,
field: field,
constraint: newConstraint,
compareTo: Filters.DefaultComparisons[compareType],
compareTo: (compareType && prevCompareTo) ? prevCompareTo : Filters.DefaultComparisons[compareType],
});
return filters.set(index, newFilter);
}
Expand Down

0 comments on commit 6fa2c8c

Please sign in to comment.