title: Why does firestore / AngularFire SDK packs multiple promises to one request?
body: <p>Here is how I write a document and it's subcollections: </p>
  
  <pre><code> public async setEvent(event: EventInterface): Promise&lt;void[]&gt; {
      return new Promise&lt;void[]&gt;(async (resolve, reject) =&gt; {
        const writePromises: Promise&lt;void&gt;[] = [];
        event.setID(event.getID() || this.afs.createId());
        event.getActivities()
          .forEach((activity) =&gt; {
            activity.setID(activity.getID() || this.afs.createId());
            writePromises.push(this.afs.collection('events').doc(event.getID()).collection('activities').doc(activity.getID()).set(activity.toJSON()));
            activity.getAllStreams().forEach((stream) =&gt; {
              this.logger.info(`Steam ${stream.type} has size of GZIP ${getSize(this.getBlobFromStreamData(stream.data))}`);
              writePromises.push(this.afs
                .collection('events')
                .doc(event.getID())
                .collection('activities')
                .doc(activity.getID())
                .collection('streams')
                .doc(stream.type) // @todo check this how it behaves
                .set({
                  type: stream.type,
                  data: this.getBlobFromStreamData(stream.data),
                }))
            });
          });
        try {
          await Promise.all(writePromises);
          await this.afs.collection('events').doc(event.getID()).set(event.toJSON());
          resolve()
        } catch (e) {
          Raven.captureException(e);
          // Try to delete the parent entity and all subdata
          await this.deleteEvent(event.getID());
          reject('Something went wrong')
        }
      })
    }
  </code></pre>
  
  <p>However when I look at the network tab: </p>
  
  <p><a href="https://i.stack.imgur.com/kUKgH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kUKgH.png" alt="enter image description here"></a></p>
  
  <p>I see one request firing up, well ok so far , <code>req_0</code> data is my <code>activity</code> but looking further on the same request I can see: </p>
  
  <p><a href="https://i.stack.imgur.com/iwcBw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iwcBw.png" alt="enter image description here"></a></p>
  
  <p>So it adds more data and that should not happen because: 
  a) I pass the size of the request to the firestore (1mb) 
  b) due to slow connection I pass the time limit to write. </p>
  
  <p><strong>Most interesting is that this behavior happens when I have a slow network.</strong> </p>
  
  <p>EDIT: Here is the payload of the request example: </p>
  
  <p><a href="https://i.stack.imgur.com/bY8Wx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bY8Wx.png" alt="enter image description here"></a></p>
  
  <p>Anyone, to explain why this? </p>