Conversation
287b768 to
d949cfb
Compare
d949cfb to
ca81c17
Compare
Remove the prop merging magic from the selectors. The original intention was to allow multiple instances of a component with a given id to exist, but to have them collapsed down and merged in the selector. This would have been useful for a component that was the product of props from a route component _and_ a dispatched component. However the complexity this added far outweighed the benefit, and the behavior was not intuitive. The new version of `addComponent` no longer has the option for a custom id, and will not result in props merging with existing components. A new `setComponent` action is used when the id must be explicitly specified. If an existing component with the given id exists, it is replaced rather than merged on to. What does remain of the component merging logic is a new `updateComponent` action that can be used to update the props of an existing component. Props dispatched in the `updateComponent` _are_ merged into the existing props of the component with the matching id. An `update` function is also now included alongside the `remove` function on each component returned through the connector. This offers an interface for updating the "state" of the component where `update` is used like react `setState`.
ca81c17 to
dde7032
Compare
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.
Remove the prop merging magic from the selectors. The original intention was to allow multiple instances of a component with a given id to exist, but to have them collapsed down and merged in the selector. This would have been useful for a component that was the product of props from a route component and a dispatched component. However the complexity this added far outweighed the benefit, and the behavior was not intuitive.
The new version of
addComponentno longer has the option for a custom id, and will not result in props merging with existing components.A new
setComponentaction is used when the id must be explicitly specified. If an existing component with the given id exists, it is replaced rather than merged on to.What does remain of the component merging logic is a new
updateComponentaction that can be used to update the props of an existing component. Props dispatched in theupdateComponentare merged into the existing props of the component with the matching id. Anupdatefunction is also now included alongside theremovefunction on each component returned through the connector. This offers an interface for updating the state of the component (whereupdateis used like reactsetState).