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

feat(atoms): dedupe mapped signal events that reach multiple children #221

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

bowheart
Copy link
Collaborator

@bowheart bowheart commented Mar 17, 2025

Description

MappedSignal#set currently handles the case where a single call causes updates in multiple inner signals. It also filters down which events to pass to each inner signal.

MappedSignal#send is missing these features - when an event is sent directly to the wrapping signal that reaches multiple inner signals, each inner signal will propagate the event again, back up to the mapped signal and its observers. MappedSignal#send also does not support the object overload of Signal#send even though the types suggest it does.

Fix those cases. Make MappedSignal#send handle the object overload. Make it only propagate each event to its own observers once. Also give mapped signals the ability to specify their own events. Add tests for all of that.

@bowheart bowheart merged commit 3ab87eb into master Mar 17, 2025
2 checks passed
@bowheart bowheart deleted the josh/mapped-event-deduping branch March 17, 2025 23:47
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.

1 participant