You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm unfortunately running into a problem where I have multiple plugins/handlers (in said plugin) running with equal specificity and one of the handlers needs data from another of the handlers.
Because this essentially results in a stalemate/undefined execution order when running handlers/middleware with equal specificity I'd propose an API to defer the call of the middleware/handler.
Essentially the api should look something like this:
This'll essentially just add the handler again to the end of the current specificity callstack so It'll be called again when the other handlers have ran and hopefully the data has been set to the state.
Does this seem impossible, or is there some better way of achieving this behavior?
(Like a promise that I await in the state object? If yes, could this be documented? :D)
meta: I'm not open to smashing all of the handler logic together into a single function as they are encapsulated well and each handler runs with "the least privilege possible" and every handler is really clear what is it's responsibility.
EDIT: Seems I just need to rework the code to scope itself better. The original way I did the things I needed was less verbose, but the reworked code will just instantiate more preconfigured generated functions from the plugin config and pass them forward.
I'll try to document the refactoring at some point, that someone that hits this issue will have some guidance how to go forward.
The text was updated successfully, but these errors were encountered:
Hi!
I'm unfortunately running into a problem where I have multiple plugins/handlers (in said plugin) running with equal specificity and one of the handlers needs data from another of the handlers.
Because this essentially results in a stalemate/undefined execution order when running handlers/middleware with equal specificity I'd propose an API to defer the call of the middleware/handler.
Essentially the api should look something like this:
This'll essentially just add the handler again to the end of the current specificity callstack so It'll be called again when the other handlers have ran and hopefully the data has been set to the state.
Does this seem impossible, or is there some better way of achieving this behavior?
(Like a promise that I await in the state object? If yes, could this be documented? :D)
meta: I'm not open to smashing all of the handler logic together into a single function as they are encapsulated well and each handler runs with "the least privilege possible" and every handler is really clear what is it's responsibility.
EDIT: Seems I just need to rework the code to scope itself better. The original way I did the things I needed was less verbose, but the reworked code will just instantiate more preconfigured generated functions from the plugin config and pass them forward.
I'll try to document the refactoring at some point, that someone that hits this issue will have some guidance how to go forward.
The text was updated successfully, but these errors were encountered: