Skip to content

Collections expose private state via iteration callbacks. #99

Description

@DominoPivot

Naively forwarding a callback function to a private collection inside a signaling wrapper exposes it to untracked reads and writes.

Taking SignalMap as an example, instead of:

forEach (fn) {
  this.collection.get();
  this.vals.forEach(fn);
}

...you probably want to pass the signaling collection to the callback:

forEach (fn) {
  this.collection.get();
  this.vals.forEach((v, k) => fn(v, k, this));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions