react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Add the possibility to hide savedquery option with property in filter-button

Open ogustavo-pereira opened this issue 1 year ago • 4 comments

After updating react-admin v4 added SavedQueriesList functionality. This functionality is very valid for some cases, but I don't think that all areas of an application would be interesting to have this SavedQueriesList.

SavedQueriesList

The problem is that today there is no parameter that can disable this functionality in the listing. I would like to suggest a property to hide the savedquery and if allowed would raise the PR by adding.

ogustavo-pereira avatar Aug 10 '22 12:08 ogustavo-pereira

Hi, and thanks for your suggestion. Could you list a few use cases where you would not want to let users save a combination of filters they have applied to a list?

fzaninotto avatar Aug 10 '22 13:08 fzaninotto

I have a use case, we're developing a feature to make the saved queries persistent between different devices, so we're going to save them in our database and load them on user login. In the meantime, we would like to disable it to avoid confusion among the users.

gengue avatar Aug 10 '22 16:08 gengue

Hi @fzaninotto today my main problem is because we want to enable this functionality incrementally per client, so we had to abstract this component. However, I made some suggestions.

  • Don't create confusion for areas that shouldn't have this type of filter
  • in terms of data protection, there may be some platform conditions that restrict the persistence of information. In this way, the filter could not be used to persist a target just for real-time query.
  • Another case I see is a listing where there is only real-time data. In this case, there is no need to save the filter as the saved data may no longer exist. In this case would not have a useful filter.
  • Listings that have only a single filter, for example a boolean filter, this listing would not need this functionality, as it would be redundant.
  • Custom filter forms that for some reason are not so well compatible with the saved query, but that already use the filter button in their structure

ogustavo-pereira avatar Aug 10 '22 17:08 ogustavo-pereira

This would be useful for us as well: We use our own saved queries that also save the user's selected columns, including the order of those columns, along with the sort and filters.

ZachSelindh avatar Aug 10 '22 17:08 ZachSelindh

Thanks for your insights! These are valid use cases, so I'm marking this as an enhancement.

The react-admin core team doesn't need this feature, so we won't spend time on it in the foreseeable future. Feel free to open a PR to implement it.

If this request receives no contribution, we'll close it within a month.

fzaninotto avatar Aug 21 '22 06:08 fzaninotto

I will push up the pr

ogustavo-pereira avatar Aug 22 '22 18:08 ogustavo-pereira

Wait, there is something I don't understand. Adding the <SavedQueriesList> to a sidebar is totally opt-in. What is the problem.

fzaninotto avatar Aug 23 '22 16:08 fzaninotto

Wait, there is something I don't understand. Adding the <SavedQueriesList> to a sidebar is totally opt-in. What is the problem.

While @oguhpereira had referred specifically to the SaveQueriesList component, I had understood this issue to also pertain to the "Save current query..." option and related functionality within the "Add Filter" button/menu.

ZachSelindh avatar Aug 23 '22 18:08 ZachSelindh

Wait, there is something I don't understand. Adding the <SavedQueriesList> to a sidebar is totally opt-in. What is the problem.

While @oguhpereira had referred specifically to the SaveQueriesList component, I had understood this issue to also pertain to the "Save current query..." option and related functionality within the "Add Filter" button/menu.

Exactly ended up generating a small mistake in relation to that point. The pr that I am proposing is exactly to give the possibility of not displaying the save query in the filter button. I corrected the description, sorry for the mistake @fzaninotto

ogustavo-pereira avatar Aug 23 '22 18:08 ogustavo-pereira

I created a pr here to make it clearer what I mean.

ogustavo-pereira avatar Aug 27 '22 01:08 ogustavo-pereira

Fixed by #8113

fzaninotto avatar Sep 01 '22 14:09 fzaninotto