TernaryFilter null state is broken after refreshing and reseting filters.

Ran into issue with TernaryFilter, which also applies to TrashedFilter that's present in https://github.com/filamentphp/demo. This only started breaking since version 3.0.28 when filter query params were introduced. How to reproduce the issue: 1. Set up filament demo 2. Upgrade to version 3.0.28 or above 3. Open Customers index /shop/customers 4. Enable filter With deleted records 5. Refresh the page 6. Click Reset button in filter form 7. Observe that url query parameter has null for filter value 8. Refresh the page 9. Observe incorrect filter being applied.
11 Replies
plytas.dev
plytas.devOP16mo ago
Here's a recording of this issue.
plytas.dev
plytas.devOP16mo ago
Notice that when applying With deleted records there's a first row Dr. Dustin ... that's actually soft deleted. After reseting filters and refreshing page the filter gets applied again. This does not happen if you don't refresh the page in step 5. In that case reseting filters removes query param completely. I believe what happens is that state value becomes a string "null" and it becomes true when being cast to bool.
cheesegrits
cheesegrits16mo ago
If it's a reproduceable bug, submit an issue on github (or a PR to fix it).
plytas.dev
plytas.devOP16mo ago
Tried investigating it further, but wasn't able to find a fix, so I'll submit an issue.
plytas.dev
plytas.devOP16mo ago
Bot autoclosed the issue even though I did put reproduction repository which is https://github.com/filamentphp/demo
GitHub
GitHub - filamentphp/demo: Source code for the demo.filamentphp.com...
Source code for the demo.filamentphp.com website. Contribute to filamentphp/demo development by creating an account on GitHub.
plytas.dev
plytas.devOP16mo ago
Fork it is
cheesegrits
cheesegrits16mo ago
Yeah, it doesn't let you just point at the demo. Please do fork it, and add the code from your instructions.
Kenneth Sese
Kenneth Sese16mo ago
This is a known issue with filter, LW, and the query string
Kenneth Sese
Kenneth Sese16mo ago
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...
Kenneth Sese
Kenneth Sese16mo ago
PR as well since Caleb isn’t making this a priority:
Kenneth Sese
Kenneth Sese16mo ago
GitHub
TernaryFilter null state is broken after refreshing and reseting fi...
Package filament/filament Package Version v3.0.34 Laravel Version v10.20.0 Livewire Version v3.0.0 PHP Version PHP 8.2.7 Problem description Ran into issue with TernaryFilter, which also applies to...
Want results from more Discord servers?
Add your server