Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Live() bypasses deferFilters() #15205

Open
davide-alpi opened this issue Dec 30, 2024 · 1 comment
Open

Live() bypasses deferFilters() #15205

davide-alpi opened this issue Dec 30, 2024 · 1 comment
Labels

Comments

@davide-alpi
Copy link

davide-alpi commented Dec 30, 2024

Package

filament/filament

Package Version

v3.2.124

Laravel Version

v11.0

Livewire Version

No response

PHP Version

PHP 8.3.0

Problem description

When using custom form filters in tables, live() fields bypass the deferFilters() setting, causing the query to rerun immediately after the field is modified.

This issue seems to occur because the deferFilters() mechanism relies on the live() property, as seen in the following filament code:

Line 36 of filament/tables/src/Concerns/HasFilters.php

->when(! $this->getTable()->hasDeferredFilters(), fn (Form $form) => $form->live());

Expected behavior

I expect deferFilters() to be independent of the content of my filter form. For example, I'm using dynamic type properties in my filter form (https://filamentphp.com/docs/3.x/forms/advanced#dynamic-fields-based-on-a-select-option), and live() property is very much needed (if you know a workaround to make it working without live(), please share).

Steps to reproduce

  • Use a filter form in a table with a field that has live() setting.
  • Enable deferFilters() option
  • Check that modifying the said field triggers query update, even if it should wait apply button action.

Reproduction repository (issue will be closed if this is not valid)

https://github.com/davide-alpi/filament-issue-defer-filters

Relevant log output

No response

@jimiero
Copy link

jimiero commented Jan 2, 2025

Not sure if related, but seems when you have a custom action on your Resource getHeaderActions() method , the action can't access the live updated table filters values, i have to refresh manually the page so the the action sees the changes in the filters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

2 participants