title: VueJS + Firestore- Autosaving votes
body: <p>I have a site similar to stack overflow where users can up and down vote posts. My question is how can I efficiently save this information to firestore under the Vuejs / Firestore/ VUEX architecture? How do other sites like stackoverflow/ reddit handle this?</p>
  
  <p>I don't want to save directly on click because Firestore charges by the write and it would be very easy for a user to toggle up/ down votes many times consecutively. I also have a number of cloud functions this would trigger, each of which take time to complete.</p>
  
  <p>I see a few alternatives. I could set a 2 second timer interval once a vote is cast, and if it doesn't change in that time, commit it to firestore. This has the downside of not working when the user leaves the page too quickly and after testing a few bigger sites, this approach seems to be of lower quality.  </p>
  
  <p>Another alternative is to save on page refresh/ exit with VUEX. Although the solutions I have found for this seem to rely on using the <em>window</em> object, which I hear may not work well if/ when I implement SSR into my app.</p>
  
  <p>Perhaps there is a built in solution for this?</p>