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

split event handlers #227

Merged
merged 7 commits into from
Aug 7, 2023
Merged

split event handlers #227

merged 7 commits into from
Aug 7, 2023

Conversation

mordamax
Copy link
Contributor

@mordamax mordamax commented Aug 1, 2023

To simplify the onIssueCommentCreated.ts handler I have split it into more granular parts
I wanted to store handlers in different files so it's easier to navigate

@mordamax mordamax requested a review from a team as a code owner August 1, 2023 17:29
@mordamax mordamax marked this pull request as draft August 1, 2023 17:37
@mordamax mordamax marked this pull request as ready for review August 3, 2023 09:23
constructor(message: string = "Something went wrong with event handler data") {
super(message);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels like it would be considerably simpler, if the handlers were context-free, and the ctx, payload, octokit, parsedCommand would be normal arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i started making it like this, but then too many things could be re-used, so I made it like this. Ultimately there are downsides and things that could look better in both approaches imo

Copy link
Contributor

@mutantcornholio mutantcornholio left a comment

Choose a reason for hiding this comment

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

Not a huge fan of .bind(this), but won't object merging

@mordamax mordamax merged commit 26101d4 into master Aug 7, 2023
2 checks passed
@mordamax mordamax deleted the mak-split-handlers branch August 7, 2023 11:29
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.

2 participants