Closed anchan42 closed 5 months ago
This is expected behaviour. It's reloading the page you're on with the given query string. Nothing is changed unless told otherwise.
If you want to work with a blank slate, use a manual router.get
instead.
I tried that but all the props got reloaded and caused the backend to re-evaluate all of them.
I do understand that can be an expected behaviour. As the name suggested reload could be understood as hitting the same URL with nothing changed.
However, we can update and add to the query string or even set them to blank but can't remove them. Can't help feeling that something is missing.
I will have to make do with blank query strings, I suppose. It is not the end of the world, to be honest. No users would probably notice. The ugly URL would just bug me everytime I look at it though 🥴
router.get('/', {
sizes:value
},{
preserveState: true
})
For the ones that would find it useful
router.visit(window.location.pathname)
if a full reset is intended.
visit()
or get()
and window.location.pathname
Thanks all, gonna close this one now.
Version:
"@inertiajs/vue3": "^1.0.14"
Describe the problem:
When the property of the data option object is removed, reload will not remove the corresponding query string from the URL. The query string would be the last value before the removal.
Steps to reproduce:
router.reload({ data:{search:'gold'} })
Would produce 'search=gold' query string
Reload the page again with:
router.reload({ data:{search:'wood'} })
Would produce 'search=wood' query string. This is expected.
But again with:
`router.reload({ data:{} })
The query string would remain 'search=wood'.
However this:
router.reload({ data:{search:null} })
or
router.reload({ data:{search:''} })
Would produce 'search='.