$router.push(query | vue router push not updating query
Aftermoredebugging,itlooksliketheissuewasthatoncreated()iwasassigningavariable,filterstothis.$route.query.Assoonasiremovedthat,settingthequerystringasmyfiltersobjectupdatesworksasexpected.Thefixwastochangemyassignmentinthecreated()methodto:this.filters=JSON.parse(JSON.stringify(this.$route.query));fromthis.filters=this.$route.queryOnceIdidthat,Iwasabletousethis.$router.replace({path:this.$route.params[0],query:filters});withoutanyissues!Hopefullythishelpssomeonestuckwiththis!
After more debugging, it looks like the issue was that on created() i was assigning a variable, filters to this.$route.query.
As soon as i removed that, setting the query string as my filters object updates works as expected.
The fix was to change my assignment in the created() method to:
this.filters = JSON.parse(JSON.stringify(this.$route.query));
from
this.filters = this.$route.query
Once I did that, I was able to use this.$router.replace({ path: this.$route.params[0], query: filters }); without any issues!
Hopefully this helps someone stuck with this!