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

🐛 Removed false positive duplicate global handler issue #1629

Conversation

sadlowskij
Copy link
Contributor

Proposed Changes

This commit stops the same handler to be added to globalHandlerMap twice. This lead to an error, where it reported a duplicate handler even though it was the same handler twice. This can happen with intentMaps, e. g. you have an intentMap like this:

  routing: {
    intentMap: {
      'AMAZON.HelpIntent': 'HelpIntent',
    }
  },

and a handler like this:

  @Handle({global: true, intents: ['HelpIntent', 'AMAZON.HelpIntent']})
  help(): Promise<void> {
    throw new Error('just a test');
  }

I am aware that in most cases, you should just not use AMAZON.HelpIntent in the intents array and it works just fine. However, if you are using one and the same component in multiple projects that might have different intentmaps, this might actually make things easier. Also, even though this might not be the best implementation, I don't think it was intended to treat the same handler as duplicate in this specific scenario in the first place.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@sadlowskij sadlowskij changed the base branch from v4/latest to v4/dev April 15, 2024 14:38
@aswetlow aswetlow requested a review from jankoenig May 14, 2024 10:31
Copy link
Member

@jankoenig jankoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sadlowskij!

@aswetlow aswetlow merged commit b77b544 into jovotech:v4/dev May 14, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants