[Vuejs]-Firebase's update function lags behind button click on browser

3👍

You need to do as follows:

  this.pingu.votes++
  pingu.set({
    votes: this.pingu.votes
  })

In addition, note that, to increment the value of a field, it is safer to use FieldValue.increment, see https://firebase.googleblog.com/2019/03/increment-server-side-cloud-firestore.html and https://firebase.google.com/docs/reference/js/firebase.firestore.FieldValue#static-increment

Leave a comment