-
Notifications
You must be signed in to change notification settings - Fork 379
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
[Discussion] Plugin Composition #733
Comments
For starters, we could accept plugins as functions (reducers, basically). The result of the function, called with the initial/current config, would be treated the same as a static plugin. This may be sufficient to allow enhancer/container components to be composed instead of replaced. |
@sel129 ran into this in #741:
It's reasonable to expect enhancers to build on each other, rather than be replaced, but changing that in 1.x would be a breaking change. Two ways occur to me to implement this without a breaking change:
Both of these would render Between the two, I think I prefer the former, as it seems more deterministic. |
FYI, I am hacking around this weekend on implementing support for plugins as functions. |
@dahlbyk I've been thinking about the idea of plugins as reducers and I'm starting to like it. My initial concern is that it allows plugins to do ... like anything at all since they are getting the full Griddle configuration up to that point when they are run, though I suppose it doesn't really matter since its up to devs to decide what is appropriate. On a basic level, each plugin would pretty much just add itself to the overall state/config in the same way that the Griddle initialization loops do, but if you needed finer grained control you would have it if necessary. I'm working on changes to the selectorsUtils that should make a 'by plugin' adding of selectors easier. |
That's exactly the idea. And if a plugin is provided as a plain object, we will continue to merge it into the configuration using current semantics (components get replaced, reducers get combined, etc). Does the |
Not explicitly, however I am adding some more features to the selectors and they way I'm doing it should make it very easy for reduceable plugins to add their own selectors onto the pile. It also may in the future enable fancier intermediate changes to the selectors by each plugin. I'll share it when its done. |
Griddle version
1.x and/or 2.x
Expected Behavior
Plugins and components compose well.
Actual Behavior
ContainerEnhancer
,Container
andEnhancer
are unclearThoughts on how this situation can be improved?
The text was updated successfully, but these errors were encountered: