React-admin: Resource with filters to no filters bug

Created on 1 Nov 2017  Â·  5Comments  Â·  Source: marmelab/react-admin

What you were expecting:
Put some filters on the resource. Refresh the page just incase. Click the resource link which removes all the filters. The page doesn't update.

Related code:
The List getQuery functions need to be altered to my knowledge.

Demo:
https://gyazo.com/ad9c9bc109a4d84b590cc162784d0a36

  • Admin-on-rest version: 1.3.2
  • React version: 15.5.4
  • Browser: Chrome

Most helpful comment

@Toosick, I completely agree.

@fzaninotto If this truly is a "featureâ„¢", is there at least be a way to disable it?

All 5 comments

It's not a bug, it's a featureâ„¢.

The resource link doesn't remove all the filters, it keeps them. This is a UX choice motivated by the fact that, if a user has a filtered list of commands, and clicks on a customer name, then return to the list of commands, they expect it to be just like when they left it - filtered.

The URL should correspond to what you are seeing on the screen. Clearly the filtered list doesn't correspond to the barebones resource URL when you click the menu. This disagrees with React fundamentals of declarative components. You have introduced internal state in the component by making the view out of sync with the URL. The URL says the filters are null, the component should have null filters.

then return to the list of commands should be done with the back button and will have the correct filters when you click back.

@Toosick, I completely agree.

@fzaninotto If this truly is a "featureâ„¢", is there at least be a way to disable it?

This feature would be very useful.

  • Solution 1: Write a custom menu item, which links to the resource with an empty filter.
  • Solution 2: Write a "reset filters" button that resets the part of the redux store storing the filters for that resource
Was this page helpful?
0 / 5 - 0 ratings

Related issues

pixelscripter picture pixelscripter  Â·  3Comments

aserrallerios picture aserrallerios  Â·  3Comments

Dragomir-Ivanov picture Dragomir-Ivanov  Â·  3Comments

nicgirault picture nicgirault  Â·  3Comments

kikill95 picture kikill95  Â·  3Comments