Skip to content

Treat reads/exceptions during equals as if the computed had performed them#90

Merged
littledan merged 2 commits intomainfrom
equals-tracked-reads
Apr 1, 2024
Merged

Treat reads/exceptions during equals as if the computed had performed them#90
littledan merged 2 commits intomainfrom
equals-tracked-reads

Conversation

@shaylew
Copy link
Copy Markdown
Collaborator

@shaylew shaylew commented Mar 31, 2024

Fixes #67.

Frameworks can get other behavior by wrapping user-provided equality functions, e.g. to untrack them or to augment or report errors differently. Given that you can't un-wrap or un-hide the errors, or un-untrack the reads, this choice seemed like the most primitive one for libraries to experiment on top of that still avoids the surprising leakage behavior.

Copy link
Copy Markdown
Member

@littledan littledan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent fix, thank you!

@littledan littledan merged commit 3a6ef98 into main Apr 1, 2024
@littledan littledan deleted the equals-tracked-reads branch April 1, 2024 03:16
leonsenft added a commit to leonsenft/angular that referenced this pull request Nov 27, 2024
Prevent leaking signal reads and exceptions from a custom `equal`
function of a producer `computed()` to a consumer.

Upstream tc39/proposal-signals#90 with a notable
change: Angular does **not** track reactive reads in custom `equal`
implementations.
AndrewKushnir pushed a commit to angular/angular that referenced this pull request Jan 16, 2025
Prevent leaking signal reads and exceptions from a custom `equal`
function of a producer `computed()` to a consumer.

Upstream tc39/proposal-signals#90 with a notable
change: Angular does **not** track reactive reads in custom `equal`
implementations.

PR Close #55818
AndrewKushnir pushed a commit to angular/angular that referenced this pull request Jan 16, 2025
Prevent leaking signal reads and exceptions from a custom `equal`
function of a producer `computed()` to a consumer.

Upstream tc39/proposal-signals#90 with a notable
change: Angular does **not** track reactive reads in custom `equal`
implementations.

PR Close #55818
PrajaktaB27 pushed a commit to PrajaktaB27/angular that referenced this pull request Feb 7, 2025
…r#55818)

Prevent leaking signal reads and exceptions from a custom `equal`
function of a producer `computed()` to a consumer.

Upstream tc39/proposal-signals#90 with a notable
change: Angular does **not** track reactive reads in custom `equal`
implementations.

PR Close angular#55818
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling .get within an equals function leaks dependencies into the parent context

2 participants