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

Atom().Change fires always #1097

Open
louthy opened this issue Aug 4, 2022 Discussed in #1096 · 0 comments
Open

Atom().Change fires always #1097

louthy opened this issue Aug 4, 2022 Discussed in #1096 · 0 comments
Assignees
Labels
enhancement v4 Related to version < 5.0.0 v5 Related to version 5.0.0+

Comments

@louthy
Copy link
Owner

louthy commented Aug 4, 2022

Discussed in #1096

Originally posted by mozesa August 3, 2022

var atom = Atom(Set("A", "B", "C"));

atom.Change += value => Console.WriteLine(string.Join(',', value)); 

atom.Swap(old => old.Add("D"));
atom.Swap(old => old.Add("E"));
atom.Swap(old => old);
A,B,C,D
A,B,C,D,E
A,B,C,D,E

Actually, I would like to use atom in the following context: var status = Atom(ConnectionStatus.Connected);

Now the problem is that the AtomChangedEvent<A> fires always, even if I provide swap(status, _ => ConnectionStatus.Connected).

I would like to have AtomChangedEvent<A> only when there is new value.

@louthy louthy self-assigned this Oct 22, 2024
@louthy louthy added enhancement v5 Related to version 5.0.0+ v4 Related to version < 5.0.0 labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement v4 Related to version < 5.0.0 v5 Related to version 5.0.0+
Projects
None yet
Development

No branches or pull requests

1 participant