F
Filament16mo ago
Saade

`null` query params

Livewire is adding null query parameters to the URL and not removing them
17 Replies
ralphjsmit
ralphjsmit16mo ago
Exactly! I also have this issue for a datepicker. And then Carbon throws an exception that it cannot instantiate a date from null.
Saade
SaadeOP16mo ago
yeah
Saade
SaadeOP16mo 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...
Saade
SaadeOP16mo ago
found that @kennethsese commented:
So unfortunately, while this is fixed in Livewire, this is still an issue in Filament with the tableFilters array. You can test this the same way by opening the v3 demo and setting just one of the filters. All the other filters are still set to null.

This time I don't believe its a livewire issue. Previously if you were to go set the querystring to just tableFilters[trashed][value]= livewire would change it to tableFilters[trashed][value]=null and add all the other filters as well. With the livewire fix, it correctly removes it from the url. However, if you set just one of the filters, then all the other filters are still added to the query string with null values.
So unfortunately, while this is fixed in Livewire, this is still an issue in Filament with the tableFilters array. You can test this the same way by opening the v3 demo and setting just one of the filters. All the other filters are still set to null.

This time I don't believe its a livewire issue. Previously if you were to go set the querystring to just tableFilters[trashed][value]= livewire would change it to tableFilters[trashed][value]=null and add all the other filters as well. With the livewire fix, it correctly removes it from the url. However, if you set just one of the filters, then all the other filters are still added to the query string with null values.
:/ gonna dig into this
ralphjsmit
ralphjsmit16mo ago
Hmm, too bad I presumed that it was an obvious bug in Livewire which should have been fixed Unfortunately not 😦
Kenneth Sese
Kenneth Sese16mo ago
Yeah...it's a big one!
Saade
SaadeOP16mo ago
well, as archilex said, i think its a Filament bug rn or did i misunderstood the comment?
ralphjsmit
ralphjsmit16mo ago
I'm moving to a new home from Wed-Fri, so I'm not behind my laptop unfortunately 😬
Kenneth Sese
Kenneth Sese16mo ago
Right...I think it's a Filament bug, but it's been hard to pinpoint where this is coming from It might be livewire still. I haven't had time to pull down livewire and run tests there
Saade
SaadeOP16mo ago
yeah
Kenneth Sese
Kenneth Sese16mo ago
Just don't refresh the page! 🤣
ralphjsmit
ralphjsmit16mo ago
Persisting the filters in the session also breaks the page
Saade
SaadeOP16mo ago
ok, i may found the error. @danharrin somewhere in the filament internals, the null is being set as 'null' (maybe an strval() being applied), if i manually change the filter to null, then the error is gone. i just didnt find where the offending code is located
Saade
SaadeOP16mo ago
tagging you bc you probably have an idea where this is failing to set null properly actually, maybe it's Livewire failing to parse the 'null' in the URL, because if we omit the 'null' then the value becomes null
Dan Harrin
Dan Harrin16mo ago
please open an issue and ill have a look, put a code example but dont worry about a reproduction repo
Kenneth Sese
Kenneth Sese16mo ago
There’s already an issue that was reopened: https://github.com/filamentphp/filament/issues/7129
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
Following up with this, I’m pretty confident now that this is a livewire issue. I’ve PRed a failing test so they can dig into it: https://github.com/livewire/livewire/pull/6188
GitHub
[v3] add failing test for null values in arrays in query string by ...
Currently when using arrays in the query string, when setting one of the values in the array, all the other values get populated with null. This is related to #5932, but is still unsolved when deal...
Want results from more Discord servers?
Add your server