refine
refine copied to clipboard
[BUG] Clearing filter through the clear button in filterDropdown resets operator to eq with no way to switch it back
Describe the bug The clear button in the filterDropdown resets not just the value but also the operator always to "eq". This makes it impossible to use any other operator after clearing the filter.
To Reproduce Steps to reproduce the behavior:
- Go to a record list with filters other than
eq(for examplecontains) - Filter items by something
- Observe that the set filter operator (eg.
contains) worked properly - Now click the clear button in the dropdown and then filter to get back all results
- Observe that this works as well
- Now open the filter again and filter by the same thing as in step 2
- Observe that the results are now different since the filter operator switched from
containstoeq
Expected behavior
The operator defined in initialFilter should not be reset when clearing a filter query. This is somewhat related to https://github.com/pankod/refine/issues/1373. Without the support for that the developer is unable to switch the operator manually so it's impossible to work around this behaviour.
Screenshots

React Query Debugging Window showing the 2 requests with the changed operator:

Desktop (please complete the following information):
- OS: Windows
- Browser Edge
- Version: 2.4.11
- Used dataProvider: Airtable
Hey @IgnusG , Thank you very much for the bug report! Let's see what we can do!
+1
Hi @omeraplak , would like to work on this can you assign this to me?
@IgnusG @omeraplak
Could you please help to review the pull request https://github.com/refinedev/refine/pull/3224 ?
More details about root cause and solution in this pull request.