Home

Issue: 2618

Nuxt 1.1.1 - fetch is not called in the page - possible bug

[issue link]

After migration from rc11 to 1.1.1 my search component stoped working.

Problem
The fetch method in the page is called only for first search.

SearchComponent

      <div>
        <input type="text" v-model="q" @keyup.enter="doSearch" />
        <button type="button" @click.prevent="doSearch">Search</button>
      </div>
   methods: {
      doSearch () {
          console.log('doSearch')
          this.$router.push(`/search/0?s=${encodeURIComponent(this.q)}`)
        }
      }
    }

SearchPage

    validate ({ store, params }) {
      console.log('validate')
      return true
    },

    fetch ({ store, params, error, query }) {
      console.log('fetch')

      return store.dispatch(action, { search: query.s })
        .catch(function (reason) {
          error({statusCode: 500, message: reason})
        })

    },

When I do first search everything is ok. I get on console:

doSearch
validate
fetch

But when I do Search again (change search text and hit enter) I only get:

doSearch
validate

After research I think this is the same problem as:
https://github.com/nuxt/nuxt.js/issues/2519

But I did’t find the solution yet.

This question is available on Nuxt.js community (#c2277)