Closed jakemake closed 2 years ago
Hi @jakemake ! Thanks for reporting this issue. And thank you for adding all the extra details, this will make debugging a whole lot easier :-) I'll triage it a bit later today.
I also checked block of your code in https://github.com/eidellev/inertiajs-adonisjs/blob/main/src/Inertia.ts#L65 in js sandbox, and i'm little bit confused, because in case of testing, it works properly 🤔
const queryParams = new URLSearchParams(request.all()).toString();
url += `?${queryParams}`;
Hey @jakemake.
Please upgrade to v4.2.2
.
It seems that URLSearchParams
wasn't encoding arrays the right way. Switching to node's querystring
library seems to do the trick.
Let me know if there are any other issues.
Hello! I have an issue with $inertia.visit, when i try to visit page with url array of values Inertia makes xhr get request properly. But after inertia replaces browser url not correctly, instead of doing like this: ?querystring[]=123&querystring[]=321 inertia replaces url like ?querystring=123,321. So after page refresh my backend receive string instead of array
Steps to reproduce: Make a visit with array of data, in my case IDs like [1,2,3]
this.$inertia.visit('/admin/reservation/list/', { data: { venicleSearch: value, //array of ids }, preserveState: true, only: ['reservations'], onSuccess: () => { this.venicleSearchLoading = false }, })
In screenshot below you can see inertia behavior