[Vuejs]-Avoiding Content re-fetching when State has already populated

0👍

What is your store structure? I have found it useful to keep a boolean indicator in the store to indicate whether the content is loaded or not.

const store = new Vuex.store({
  state: {
    questions: {
      isLoaded: false,
      items: []
    }
  }
})

Then in the component where you’re fetching the questions check for this and update once loaded.

Leave a comment