1

Since I observe an unexpectedly high number of reads I tried to figure out using the docu how many reads binding the same document several times triggers.

Suppose I have an action:

export const setTodosRef = firestoreAction(
  ({ bindFirestoreRef, unbindFirestoreRef }, documentId) => {
    bindFirestoreRef('documents', db.collection('documents').doc('sameid'))
  }
)

What happens, if I call setTodosRef 3 times with same document id 'sameid'? Is it 3 or 1?

Is vuexfire smart enough to know that the same document is already bound?

Boern
  • 7,233
  • 5
  • 55
  • 86
  • 1
    In the documentation it mention that it unbinds any previously bound reference with the same key. So, I do believe, it will trigger additional reads if you bind to the same document several times. – ak22 Jan 19 '21 at 21:08
  • I ran a test (`for` loop triggering a few thousand bindings) and this did not show a spike in the read count of a test database. However, it may perfectly be that Vuex does some smart stuff under the hood that catches simple cases like this. – Boern Jan 20 '21 at 06:17

0 Answers0