Conversation
…gnals Previously, custom events dispatched alongside signal.set() or signal.mutate() were separated from the change/mutate events when propagating through MappedSignal layers. Listeners received two separate callbacks instead of one unified event map. Now, non-mutate custom events from inner signal state changes are buffered in MappedSignal.r() and included alongside change/mutate events when MappedSignal.j() runs, keeping all events together in one event map at every layer of composition. Standalone events via .send() (no state change) are still forwarded immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 9 tests verifying standalone .send() events propagate through 2/3/4/5 layers of nested MappedSignals, covering single-signal mode, map-mode, mixed nesting, object map sends, payload integrity, no change event leakage, and no double-notification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
signal.set()orsignal.mutate()now stay bundled with thechange(andmutate) event when propagating through MappedSignal layers.send()events (no state change) are still forwarded immediately as beforeThis also fixes a state tearing bug where mapped signals passed events dispatched along with
.setand.mutatecalls of inner signals to downstream listeners too early. Those listeners then ran before the inner update had fully propagated through the signal graph. That means those listeners would have to access the inner signal directly to read its current state since the outer signals that the listener is registered on don't have it yet. Deferring the passing along of those inner events in mapped signals prevents this bug completely.Test plan
🤖 Generated with Claude Code