const loadData = async () => {
        try {
            const data = await GetAllForms();
            setAllForms([...data]);
        } catch (err) {
            console.log(err);
        }
    }
My variable data is receiving the data from GetAllForms (that is a promisse function), but when I try to assign to another variable is empty, In this console log for example is showing a empty array. But if i but a console.log(data) the data appears correctly, the problem is only with the dataAux
I dont have a clue what is going on here.
Thanks!
Here the GetAllForms
export async function GetAllForms() {
    const formRef = await dbForms.collection("forms");
    const snapshot = await formRef.get();
    const dataFormattedArray = [] as IFormsFormatted[];
    snapshot.forEach(async doc => {
        const docData = doc.data() as IForms
        const aux = [] as FormsData[];
        for (const id of docData.formsFieldId) {
            const test = await GetOneFormsField(id);
            aux.push(test);
        }
        const dataFormatted = { ...docData, formsFieldId: [...aux] }
        dataFormattedArray.push(dataFormatted);
    })
    
    return dataFormattedArray;
}
If i check de allForms variable after the setAllForms, is empty.
