nuxt: router.push() is not working in latest nuxt release

router.push() is not reloading the page contents in the latest nuxt release while changing the URL query

i.e For pagination, when clicking the 2nd page, URL is changed by this.$router.push({query: {'page': 2}}). Usually router.push() will call from created hook. But now its only changing the url query and its not refreshing data.

<div align="right">This bug report is available on Nuxt.js community (#c2376)</div>

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 12
  • Comments: 39 (8 by maintainers)

Most upvoted comments

This commit should fix it: https://github.com/nuxt/nuxt.js/commit/8903db1c27942088754b8a37568e8fc364ed8c66

Thanks for your reproduction @Zip753, it helped me a lot to fix quickly this particular issue.

I will release next version this week 😃

@awronski Thanks for pointing this out! I’ve tried using this new undocumented breaking feature (seriously, what kind of attitude to users is that? 😕), but it doesn’t quite work. After some debugging it turned out that asyncData gets called once again on params update, but new result from asyncData isn’t persisted in data later.

maybe you can watch the $route and trigger the load data method😄

@AngelWayfarer you need to add watch query: https://github.com/nuxt/nuxt.js/issues/2519

export default {
    watchQuery: ['yourQueryName'],
    [...]
}

I’m still seeing an issue with this.$router.push() in Nuxt 1.4.0…

I need to update the query parameters in my route any time the underlying data changes, so I have a watcher on the different items. For example, when selectedLocations changes, I want to push a route to reflect the latest query.

The watcher is being triggered properly, but this.$router.push() isn’t firing.

Is there anything I can do to help address the problem?

It works with watchQuery but page transitions are gone. Is it meant to be so?