Skip to content

Query string should overwrite persistent local storage filter states #37

Open
@oliver-wunu

Description

@oliver-wunu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions