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

fix(BaseMessageComponent): don't create new class instances #7140

Merged
merged 1 commit into from Dec 24, 2021

Conversation

ImRodry
Copy link
Contributor

@ImRodry ImRodry commented Dec 22, 2021

Please describe the changes this PR makes and why it should be merged:
Feel free to give the PR a better title as I didn't know what to call this but this basically resolves #7139 by returning the component instance in BaseMessageComponent#create when the received data is already a discord.js class

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

@suneettipirneni
Copy link
Member

Just out of curiosity whats the performance difference here? Kinda interested to see if this has a performance upgrade

@ImRodry
Copy link
Contributor Author

ImRodry commented Dec 23, 2021

I tested it with an example class and it seems to be quite significant, not sure if this test is 100% accurate though
image

Copy link

@nitinkumar-c nitinkumar-c left a comment

Choose a reason for hiding this comment

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

Working 100%

@vladfrangu
Copy link
Member

RE #7140 (comment)

if you want an accurate performance, you'd have the class and main component creation as a setup, not in the test case. Just as an fyi 😄


Leaving that aside, this PR looks fine to me, but I'll let the rest of the maintainers decide if we merge this :D

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

Successfully merging this pull request may close these issues.

Components passed into action row are not the same as the components that are used in action row creation
6 participants