Need a nicer way of building plugins by assembling others. #1818
jonapgar-groupby
started this conversation in
General
Replies: 2 comments
-
I guess ideally the plugins array in |
Beta Was this translation helpful? Give feedback.
0 replies
-
Related #1566 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Consider this "AuthPlugin" I've made here:
Now I know I could have just done this:
But I have ioc scenarios (e.g. testing) where I don't want to "useAuth0" at all, and I want my AuthPlugin provider to deal with all of that.
The above solution with calling
addPlugin
multiple times works but as you can see I have to assertPlugin<any>
, as addPlugin expects that I'm passing a Plugin that satisfies the PluginContext of the plugin that I'm actually creating.It would be great if I could just call a method, something like this...
Though maybe this doesn't make a lot of sense either.
The whole idea of PluginContext is kinda confusing to me. It seems like this type is doing double-duty and in some places is implying that the Plugin will extend the context with these fields, and other places it is implying "the context already has these fields".
The
AfterContextBuildingEventPayload
shows this strange duality.Beta Was this translation helpful? Give feedback.
All reactions