Skip to content Skip to sidebar Skip to footer

Firebase's Update Function Lags Behind Button Click On Browser

I am trying to create a real time voting app in Vue using firebase to store the number of votes. I am able to create the data base and increment the number of votes, as well as dis

Solution 1:

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

Post a Comment for "Firebase's Update Function Lags Behind Button Click On Browser"