Skip to content

Commit

Permalink
fix: Filter string is erased when changing filter condition (parse-co…
Browse files Browse the repository at this point in the history
  • Loading branch information
vardhan0604 authored and unknown committed Oct 22, 2024
1 parent 48f8a7a commit cd9b549
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 cd9b549

Please sign in to comment.