React-admin: The filter disappears after clearing the value (displayedFilters prop problem)

Created on 17 Jan 2020  路  1Comment  路  Source: marmelab/react-admin

Greetings all.
First of all, I wanted to thank you for react-admin.
About problem. I faced with moment when filter disappears (from Filter panel) after clearing the value after returning to the page/refresh page.

What you were expecting:
displayedFilters will contain information about current filter.

What happened instead:
displayedFilters is empty.

Steps to reproduce:
How it looks you can check in RA example

  1. Open Catalog -> Posters
  2. Add filters -> Max width
  3. Set some value (e.g. 1000), url will looks like this
  4. Refresh page/or open any tile from grid and press back button
  5. Select your value from step 3 and remove (not cross button)
  6. Filter disappears

Related code:
In my project I have Author filter. When I add this filter from list (Add filter) I got this

displayedFilters: {authorId: true}
filterValues: {}

It's correct. I select some Author and now props look like

displayedFilters: {authorId: true}
filterValues: {authorId: Array(1)}

It looks correct too.
But if I refresh page (or open view page and return back) I have this props

displayedFilters: {}
filterValues: {authorId: Array(1)}

And because of displayedFilters is empty when I remove value filter is disappears.
Because of this, the user has trouble when they just want to delete the current value and enter another to select a different author.

Environment

  • React-admin version: 3.0.3 (also tested on 3.1.2)
  • React version: 16.11.0
  • Browser: Chrome (Version 79.0.3945.117), Safari (13.0.4)
bug

Most helpful comment

Reproduced. Thanks for the detailed explanation :+1:

>All comments

Reproduced. Thanks for the detailed explanation :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mstmustisnt picture mstmustisnt  路  30Comments

fzaninotto picture fzaninotto  路  79Comments

olegweb picture olegweb  路  23Comments

josephktcheung picture josephktcheung  路  22Comments

fzaninotto picture fzaninotto  路  24Comments