refine icon indicating copy to clipboard operation
refine copied to clipboard

[BUG] Clearing filter through the clear button in filterDropdown resets operator to eq with no way to switch it back

Open IgnusG opened this issue 3 years ago • 3 comments

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:

  1. Go to a record list with filters other than eq (for example contains)
  2. Filter items by something
  3. Observe that the set filter operator (eg. contains) worked properly
  4. Now click the clear button in the dropdown and then filter to get back all results
  5. Observe that this works as well
  6. Now open the filter again and filter by the same thing as in step 2
  7. Observe that the results are now different since the filter operator switched from contains to eq

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 refine-double-filter-contains-bug

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

image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Edge
  • Version: 2.4.11
  • Used dataProvider: Airtable

IgnusG avatar Dec 26 '21 13:12 IgnusG

Hey @IgnusG , Thank you very much for the bug report! Let's see what we can do!

omeraplak avatar Feb 24 '22 06:02 omeraplak

+1

spatialvlad avatar Aug 14 '22 02:08 spatialvlad

Hi @omeraplak , would like to work on this can you assign this to me?

mani-rsg avatar Oct 24 '22 09:10 mani-rsg

@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.

leapful avatar Dec 14 '22 02:12 leapful