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

[Bug]: Filters are not restored from URL after refresh #135

Open
webard opened this issue Jan 14, 2025 · 0 comments
Open

[Bug]: Filters are not restored from URL after refresh #135

webard opened this issue Jan 14, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@webard
Copy link

webard commented Jan 14, 2025

What happened?

Hello,

filters after being set are not persistent after refreshing page.

Before refreshing:
image

after refresh:
image

It will be great if package restore values to filter after refreshing panel.

Code used in filter is like in example:

 Filter::make('categories')
                    ->form([
                        SelectTree::make('categories')
                            ->relationship('categories', 'name', 'parent_id')
                            ->enableBranchNode(),
                    ])
                    ->query(function (Builder $query, array $data) {
                        return $query->when($data['categories'], function ($query, $categories) {
                            return $query->whereHas('categories', fn($query) => $query->whereIn('gbn_category_product.category_id', $categories));
                        });
                    })
                    ->indicateUsing(function (array $data): ?string {
                        if (! $data['categories']) {
                            return null;
                        }

                        return __('Categories') . ': ' . implode(', ', Category::whereIn('id', $data['categories'])->get()->pluck('name')->toArray());
                    }),

How to reproduce the bug

  • Make filter using SelectTree
  • Select some filters
  • Refresh page

Package Version

3.1.45

PHP Version

0

Laravel Version

11.38.1

Which operating systems does with happen with?

macOS

Notes

No response

@webard webard added the bug Something isn't working label Jan 14, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant