Вот рабочая версия моего кода, которая возвращает все как положено:
***.then(r => r.json()).then(async r => {
for (let i = 0; i < r.length; i++) {
let pipeline = r[i];
pipeline.collapsed = true;
pipeline.levels = await this.getPipelineLevels(pipeline.id);
}
this.project.pipelines.items = r;
})
Вот "сломанная" версия, которая возвращает странные результаты:
****.then(r => r.json()).then(r => {
let pipelines = r.map(async (value) => {
let levels = await this.getPipelineLevels(value.id);
return {...value, collapsed: true, levels: levels};
});
this.project.pipelines.levels = pipelines;
Странный вывод в консоли с console.log(JSON.stringify(pipelines))
после *.map()
:
[{"_c":[],"_s":0,"_d":false,"_h":0,"_n":false},{"_c":[],"_s":0,"_d":false,"_h":0,"_n":false}]
Что здесь происходит?