Skip to content
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

Provide a way to get <component>.<handler> path in event middleware 'event.ComponentTreeNode.executeHandler' #1292

Closed
1 of 4 tasks
rmtuckerphx opened this issue Apr 24, 2022 · 2 comments

Comments

@rmtuckerphx
Copy link
Contributor

I'm submitting a...

  • Bug report
  • Feature request
  • Documentation issue or request
  • Other... Please describe:

As part of event.ComponentTreeNode.executeHandler also provide the handler that is being called.

Some of this is provided as part of the $route but that is not updated for $redirect and $delegate:

"resolved": {
     "component": "GlobalComponent",
     "handler": "PizzaIntent",
     "global": true
   },

Expected Behavior

On every event middleware for event.ComponentTreeNode.executeHandler, I would like access to the handler as well as the component. This doesn't provide it:

jovo.$handleRequest?.activeComponentNode?.path?.join('.')

I want to be able to log and use the <component>.<handler> string for all of these:

  • "GlobalComponent.LAUNCH"
  • "GlobalComponent.PizzaIntent"
  • "LoveHatePizzaComponent.START"
  • "LoveHatePizzaComponent.lovesPizza"

Specifically, I am writing a view engine and I want to automatically set a request value:

this.$data.handlerPath = `${component}.${handler}`

This can then be used as part of the criteria for selecting output templates.

Providing a method that can always be called in event.ComponentTreeNode.executeHandler that would return the handlerPath is one solution.

Current Behavior

Access to the handler value is not available.

Error Log

No error

Your Environment

  • Jovo Framework version used: 4.2.8
  • Operating System: Windows 10 10.0.22000
@rmtuckerphx
Copy link
Contributor Author

Do you have any insights @jtfell, @aswetlow, @jankoenig ?

@jankoenig
Copy link
Member

Thank you! @aswetlow had a great idea how to solve this.

With the latest release (https://github.com/jovotech/jovo-framework/releases/tag/2022-05-17-patch), you can now access a payload using event middlewares. Learn more here https://www.jovo.tech/docs/handlers#middlewares and here: https://www.jovo.tech/docs/middlewares#event-middlewares

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants