I am running into issues whenever I try using a Set I have populated asynchronously:
const MaterialType_Requests_FromESI$ = SDE_REACTIONDATA.map(data => this.ESI.ReturnsType_AtId(data.materialTypeID));
let MaterialCollectionSet: Set<string> = new Set<string>();
let MergedMaterialTypes$ = merge(MaterialType_Requests_FromESI$);
MergedMaterialTypes$.subscribe(
MaterialType$ => MaterialType$.subscribe(MaterialType => MaterialCollectionSet.add(MaterialType.name)),
null,
() => {
console.log(MaterialCollectionSet); // Outputs Set object, with a 'size' of 98
console.log(MaterialCollectionSet.size); // Outputs 'size' as 0
}
);
If I console.log this Set, an Object is returned with a size property of 98, as well as an 'Entities' Array that has each value of the Set I am trying to access...
However, trying to access the size property directly returns a Set size of 0...
Also, the Set.entries() value is NOT being accepted within a for-of loop as an Array, even when using Array.from()...
const MaterialType_Requests_FromESI$ = SDE_REACTIONDATA.map(data => this.ESI.ReturnsType_AtId(data.materialTypeID));
let MaterialCollectionSet: Set<string> = new Set<string>();
let MergedMaterialTypes$ = merge(MaterialType_Requests_FromESI$);
MergedMaterialTypes$.subscribe(
MaterialType$ => MaterialType$.subscribe(MaterialType => MaterialCollectionSet.add(MaterialType.name)),
null,
() => {
// This loop runs zero times, despite Entries having 98 values
for(let entry of Array.from(MaterialCollectionSet.entries())) {
console.log(entry)
}
// console.log(MaterialCollectionSet); // Outputs Set object, with a 'size' of 98
// console.log(MaterialCollectionSet.size); // Outputs 'size' as 0
}
);
Posts such as this, that say to use for-of loops, suggest this should be working... but it is not.
Where/how am I miss-accessing this Sets properties???