feat(atoms, react): add single-signal wrapping to injectMappedSignal#337
Open
feat(atoms, react): add single-signal wrapping to injectMappedSignal#337
Conversation
…dSignal Add support for wrapping a single Signal directly with injectMappedSignal, creating a thin wrapper that keeps the inner signal reference up-to-date and triggers changes when the reference changes. The MappedSignal's state is identical to the wrapped signal's state, and events pass through directly. - Add F (Forwarding) property to MappedSignal for single-wrapped signal - Implement single-signal mode in set/send/r/u methods - Add function overloads to injectMappedSignal for both signatures - Add 14 comprehensive tests for single-signal wrapping functionality - Ensure all 445 existing tests continue to pass
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.
Description
Added support for wrapping a single Signal directly with
injectMappedSignal. Previously,injectMappedSignalonly accepted an object of signals. Now it accepts either aSignalMap(object) or a singleSignal, creating a thin wrapper that keeps the inner signal reference up-to-date.When wrapping a single signal, the MappedSignal's state is identical to the wrapped signal's state (not wrapped in an object), and all events pass through directly without key prefixes. This is useful for composing signals while maintaining a consistent reference to the wrapped signal across atom reevaluations.
Changes
F(Forwarding) property for single-wrapped signals and single-signal mode handling inset(),send(),r(), andu()methodsStateOfandEventsOftype helpers correctly extracting types for both approachesAll existing tests (445) continue to pass.