F
Filament9mo ago
ericmp

Duplicated url table query bug?

I build this route:
route('filament.admin.pages.my-payments', [
'tableFilters' => [
'card' => [
'value' => $record->id,
],
],
]);

// it returns -> "https://example-app.test/admin/my-payments?tableFilters%5Bcard%5D%5Bvalue%5D=1"
route('filament.admin.pages.my-payments', [
'tableFilters' => [
'card' => [
'value' => $record->id,
],
],
]);

// it returns -> "https://example-app.test/admin/my-payments?tableFilters%5Bcard%5D%5Bvalue%5D=1"
So then i visit the url, but after the page has loaded, the url changes to:
https://example-app.test/admin/my-payments?tableFilters%5Bcard%5D%5Bvalue%5D=1&tableFilters[card][value]=1
https://example-app.test/admin/my-payments?tableFilters%5Bcard%5D%5Bvalue%5D=1&tableFilters[card][value]=1
so seems it duplicates the url's querystring, one "url-encoded", and the other no
8 Replies
toeknee
toeknee9mo ago
Are you persisting data? It could be the persisted data have been put on
ericmp
ericmpOP9mo ago
wdym if im persisting data?
ericmp
ericmpOP9mo ago
im just generating the url and going to the view where i have the table - only the table, anything else im not persisting them
toeknee
toeknee9mo ago
Ok, just do:
route('filament.admin.pages.my-payments') . '?tableFilters=[card][value]=' . $record->id;
route('filament.admin.pages.my-payments') . '?tableFilters=[card][value]=' . $record->id;
route might be encoding them
ericmp
ericmpOP9mo ago
yeah, route encodes it i already did that 1st but then i changed it to array so is more easy to visualise than a raw inline string i think filament tries to decode it but somehow misses something and just decodes it and it appends it but without removing the encoded querystring not sure though just what i think it could be happening
toeknee
toeknee9mo ago
Filament will check if it's in the request, but it won't be decoding it because we don't need to encode it because the data is sanitised prior I believe. route encodes because it doesn't know what values it's acccepting. and because rotue is doing that, when filament checks it can't find our params.
ericmp
ericmpOP9mo ago
makes sense yeah ill do the inline string thing then 🤷 thanks toeknee!
Want results from more Discord servers?
Add your server