Home

Issue: 3088

Vue 'watch' has different performance in SSR and SPA

[issue link]

When enter a page for the first time, SSR and SPA perform different.

I know, SSR will return a static HTML for the first time, then Hydrate(active) the page.

But still I can’t figure out

For SSR:

export default {
  asyncData() {
    return {
      paramA: {}
    }
  },
  data() {
    return {
      paramB: {}
    }
  },
  watch: {
    paramA: function(newValue) {
       console.log('paramA', newValue) // won't print unless 'immediate: true' 
    },
    paramB: function(newValue) {
       // Here is what i'm confusing
       // will print whether 'immediate: true' or not, **Why?**
       console.log('paramB', newValue) 
    }
  }
}

For Pure Vue SPA:

export default {
  data() {
    return {
      paramC: {}
    }
  },
  watch: {
    paramC: function(newValue) {
       console.log('paramC', newValue) // won't print unless 'immediate: true' 
    }
  }
}
This question is available on Nuxt.js community (#c2673)