title: React action always dispatch before resolve all promises
body: <p>I have an async action in react, it will call a method to get a promise list, each promise also have a list data, I want to resolve all data from each promise in this promise list to a list. There should be two loop. Then dispatch an action with the data list. I initial an empty array before resolve the promise list. But the function always dispath the empty array before saving all data into this list. Can anyone teach me how to avoid this situation? Thanks.</p>
  <p>My code looks like this:</p>
  <pre><code>export const fetchNearbyMeetups = (lat, lng) =&gt; async(dispatch) =&gt; {
  
  try {
      const promises = await getMeetupsByRegion(lat, lng);
      const matchingMeetups = [];
      Promise.all(
          promises.map(async(snapshots) =&gt; {
              snapshots.then((snapshot) =&gt; {
                  snapshot.docs.map(((doc) =&gt; matchingMeetups.push(doc.data())));
              });
          }),
      );
      dispatch({
          type: FETCH_NEARBY_MEETUPS,
          payload: matchingMeetups,
      });
  } catch (err) {
      dispatch({
          type: FETCH_NEARBY_MEETUPS_ERR,
          payload: null,
      });
  }
  </code></pre>
  <p>};</p>