title: How to update Firestore with Dragula Events
body: <p>It seems impossible to make dragula drop events update the indexes in firestore, so the positions the user chooses can be saved. Even though the items change positions in the array</p>
  
  <pre><code>this.$note = this.afs.collection(`notes`, ref =&gt; ref.orderBy('priority'));
  this.$notes = this.$note.snapshotChanges().map(actions =&gt; {
         return actions.map(a =&gt; {
           const data = a.payload.doc.data();
           const id = a.payload.doc.id;
           return { id, data };
         });
       });
  
  this.$notes.subscribe((noteArray) =&gt; {
    console.log('run when change');
    this.noteArray = [];
    for (const n of noteArray) {
      // console.log('run');
      this.noteArray.push(n);
    }
  
    this.dragulaService.drop.subscribe(() =&gt; {
      this.noteArray.forEach((note, index) =&gt; {
        // console.log("note", note, index);
        this.afs.doc(`notes/${note.id}`).update({ priority: index });
      });
      console.log("noteArray", this.noteArray);
  
      this.$notes.subscribe((nArray) =&gt; {
        console.log('run when change');
        this.noteArray = [];
        for (const n of nArray) {
          // console.log('run');
          this.noteArray.push(n);
        }
        console.log("nArry", this.noteArray);
    });
  </code></pre>