Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Query string should overwrite persistent local storage filter states #37

Open
oliver-wunu opened this issue Jul 24, 2023 · 1 comment
Open
Labels
good first issue Good for newcomers

Comments

@oliver-wunu
Copy link

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.

@KasparRosin
Copy link
Member

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.

@KasparRosin KasparRosin added the good first issue Good for newcomers label Jan 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants