Skip to content

Make ValueSignal ignore identical values #23588

@Legioth

Description

@Legioth

To automatically avoid some cases of infinite loops between effects, ValueSignal should fire events only if set to a value that isn't equals() with the current value. The exception is modify which should still always fire events since it's used with mutable values where the mutation means that there's no previous state to compare with.

This behavior should be mentioned in relevant JavaDocs. To further help developers realize that equality has an impact, and potentially also cover some special cases, we should provide a constructor that allows defining a custom equality checker (SerializableBiPredicate<T, T>) while using Objects::equals by default.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions