Set emissions use the member id as index in chain and index fields.
private emitValueChange(
originalSet: Set<unknown>,
id: unknown,
value: unknown,
): void {
this.emitChange({
arguments: [],
chain: [{ context: originalSet, index: id }],
index: id,
target: originalSet,
newValue: value,
});
}
CollectionItemObserverManager listens to these member-keyed events and forwards only matching indexes.
private onChanged = (change: IPropertyChange) => {
if (change.index !== this.id) {
return;
}
if (!this._indexValueAccessor.hasValue(this.target, this.id)) {
this.value = undefined;
this.emitChange(change);
return;
}
if (!this._equalityService.isEqual(this.value, change.newValue)) {
this.value = change.newValue;
this.emitChange(change);
}
};