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(core): handle nested context correctly with UseCls decorator #119

Merged
merged 1 commit into from
Feb 3, 2024
Merged

fix(core): handle nested context correctly with UseCls decorator #119

merged 1 commit into from
Feb 3, 2024

Conversation

alexandre-abrioux
Copy link
Contributor

@alexandre-abrioux alexandre-abrioux commented Feb 2, 2024

Issue

Methods decorated with @UseCls() (without runOptions) are not called when running inside a parent context.

Fix

This PR prepends the default options to the options passed down to the cls.run(options, callback) function. This way, options.ifNested is always defined (default to inherit), and the callback is always triggered in the switch (options.ifNested) ... case block.

Since @UseCls() calls run with an empty options object: cls.run({}, callback) ; it fixes the issue 👍

@Papooch
Copy link
Owner

Papooch commented Feb 2, 2024

Thank you for finding and fixing all these issues 💪 I'll get to revieving them as soon as I get to a computer!

@Papooch Papooch changed the title fix(use-cls-decorator): handle nested context fix(core): handle nested context correctly with UseCls decorator Feb 3, 2024
Copy link
Owner

@Papooch Papooch left a comment

Choose a reason for hiding this comment

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

LGTM 💪

@Papooch Papooch merged commit df90f30 into Papooch:main Feb 3, 2024
2 checks passed
@alexandre-abrioux alexandre-abrioux deleted the fix-usecls branch February 3, 2024 13:55
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

2 participants