Below is a functional version of my code that produces the expected output:
***.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;
})
Here is the problematic version that is yielding unexpected results:
****.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;
An odd result in the console when using
console.log(JSON.stringify(pipelines))
after *.map()
:
[{"_c":[],"_s":0,"_d":false,"_h":0,"_n":false},{"_c":[],"_s":0,"_d":false,"_h":0,"_n":false}]
Can you figure out what could be causing this issue?