Skip to content

Fix: Before hook does not run with async callback returning Promise #4380

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ac-mmi
Copy link

@ac-mmi ac-mmi commented Feb 15, 2025

In file _basehook.js here in this line const invocationResult = this.context.invokeMethod(this.key, client, argsCount they weren't
handling async results properly—if a hook returned a promise. Now, I added a check: if result is a promise, it then() waits for it and catches any errors. If it’s not a promise, it works the same way as before.

Fixes #4379

@ac-mmi ac-mmi closed this Feb 15, 2025
@ac-mmi ac-mmi reopened this Feb 16, 2025
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.

before hook does not run with async callback returning Promise<undefined>.
1 participant