Nested forEach, both for pushing data in array, but the other one is showing 0 length in console

async function GetUserRecords(dbUID){
const dbUserRef = collection(db, "profile");
const dbUserResRef = collection(db, "profile", dbUID, "records");
const q = query(dbUserResRef, orderBy('date', 'desc'), limit(1));

onSnapshot (q, (querySnapshot2)=>{
    // for (let doc2 of querySnapshot2){
    querySnapshot2.forEach(doc2 =>{
        const data1 = doc2.data();
        usersRecords.push(doc2.data());
    })
});}



async function GetAllDataRealtime(){
const dbUserRef = collection(db, "profile");

 onSnapshot (dbUserRef, (querySnapshot)=>{
     users = [];
     usersRecords = [];
     querySnapshot.forEach(doc =>{

         var dbUID = doc.data().id;
         GetUserRecords(dbUID);
         users.push(doc.data());
     });
     AddAllItemsToTable(users, usersRecords)
})



window.onload = GetAllDataRealtime();

im using this code to get data in firestore and output it in a table, but when I run it, one of the two arrays will have a data inside but the length of it is 0, so it makes it never shows data in my table