nova-detached-filters
nova-detached-filters copied to clipboard
Query string should overwrite persistent local storage filter states
First of all thank you very much for this awesome package, we heavily us it within our project.
We have a case where we want to link from the Nova dashboard to a resource with a specified filter set, but by clicking the link the view loads the last persisted filter stored to the local storage.
What we would expect is that the persisted filter state gets updated when an url with filter query is requested or maybe add a third option to persistFilters(bool $value = true, bool $default = false, bool $prioritizeQueryString = false)
if prioritizeQueryString
is set to true local storage gets updated to the query string value, if set to false the persisted local storage filter state gets applied regardless if there is a filter query string available.
UserResource.php
public function cards(NovaRequest $request): array { return [ (new NovaDetachedFilters([(new UserStatusFilter())->withMeta(['width' => 'w-1/5'])])) ->width('full') ->persistFilters(true, true) ->withToggle() ->withReset(), ]; }
Dashboard link to filtered resources
<laravel-nova-url>/resources/user-resources?user-resources_page=1&user-resources_filter=W3siQXBwXF...
Thank you very much in advance and we are looking forward to a possible solution.
I think I agree with you. I'd even go as far and say that this should be the behaviour out of the box without additional configuration or passing a 3rd option. If you have time to take a look at it, I'd gladly review and merge the pull request.