inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.02k stars 405 forks source link

Query Param array gets repeated after second call to any router method #1897

Closed eddi00 closed 2 weeks ago

eddi00 commented 2 weeks ago

Hi there, I'm trying to send the server multiple query array parameters and after clicking a method button after the first time the arrays values get merged together when the expected behavior is them to be replaced.

Example: router.reload({ data: { ports, cities, }, });

Both variables ports and cities are arrays.

After many times clicking the search button the result is: http://localhost:4000/page?cities[]=1&cities[]=1&cities[]=1&ports[]=5&ports[]=5&ports[]=5

I'm using "@inertiajs/react": "^1.0.15"

I think the issue is in this line

https://github.com/inertiajs/inertia/blob/eb19b39c6fc526cb2b52c3e4302f43767920eb0a/packages/core/src/url.ts#L24

Thanks in advance!

driesvints commented 2 weeks ago

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Thanks!