F
Filament16mo ago
HL

Filter value=null error after refreshing page

I have a simple filter in my Resource's table:
return $table
...
->filters([
SelectFilter::make('service')
->placeholder('All')
->options([
1 => 'Account',
2 => 'Custom Leveling',
])
->native(false),
])
...
return $table
...
->filters([
SelectFilter::make('service')
->placeholder('All')
->options([
1 => 'Account',
2 => 'Custom Leveling',
])
->native(false),
])
...
I open the resource table from the url: http://127.0.0.1:8000/admin/all-orders This sql query runs:
select * from `all_orders` order by `id` desc limit 10 offset 0
select * from `all_orders` order by `id` desc limit 10 offset 0
All good. Now I set the filter once to something http://127.0.0.1:8000/admin/all-orders?tableFilters[service][value]=1 I refresh the page, still all good Than delete the filter, and get to this url: http://127.0.0.1:8000/admin/all-orders?tableFilters[service][value]=null I refresh, and no result are shown and this sql query is run:
select count(*) as aggregate from `all_orders` where (`service` = 'null')
select count(*) as aggregate from `all_orders` where (`service` = 'null')
The service is always an integer, can't be null. Is it the intended way for the url query to switch to null, in case I delete the filter? I noticed, that this isn't the case when I never refresh the site, that is what's causing the problem.
Solution:
This is a known issue with Livewire v3. Filament Issue here: https://github.com/filamentphp/filament/issues/7129 At the bottom there is a workaround you can implement in the meantime....
GitHub
Query string includes all available filters causing an error on ref...
Package filament/filament Package Version v3 Laravel Version v9.19 Livewire Version v3 PHP Version PHP 8.1 Problem description In v3 when you select a filter, the query string will then populate wi...
Jump to solution
5 Replies
HL
HLOP16mo ago
It also adds a 3rd option to the filter select field:
HL
HLOP16mo ago
And that is selected when I open the url I checked another simpler resource, and it doesn't have this issue
Solution
Kenneth Sese
Kenneth Sese16mo ago
This is a known issue with Livewire v3. Filament Issue here: https://github.com/filamentphp/filament/issues/7129 At the bottom there is a workaround you can implement in the meantime.
GitHub
Query string includes all available filters causing an error on ref...
Package filament/filament Package Version v3 Laravel Version v9.19 Livewire Version v3 PHP Version PHP 8.1 Problem description In v3 when you select a filter, the query string will then populate wi...
HL
HLOP16mo ago
Thank you very much!
HL
HLOP16mo ago
@kennethsese thank you for the time you put into this problem on github!
Want results from more Discord servers?
Add your server