Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added distinctObservable() to Delegates #5406

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kw-indie
Copy link

@kw-indie kw-indie commented Feb 17, 2025

Added kotlin.properties.Delegates.distinctObservable delegate.

Delegates.observable is triggered even when the value hasn't changed (set to the same value). This was unintuitive for me, and not mentioned in the docs.
It was still achievable with Delegates.vetoable, but that just requires more work for a much needed function like this.
I know we can't change Delegates.observable itself. So, I added distinctObservable, which does what observable should have done (imo).

@kw-indie kw-indie changed the title added distinctObservable() to Delegates Added distinctObservable() to Delegates Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants