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: #1335: async middleware called twice #1422

Merged
merged 3 commits into from Sep 18, 2019
Merged

fix: #1335: async middleware called twice #1422

merged 3 commits into from Sep 18, 2019

Conversation

mleguen
Copy link
Member

@mleguen mleguen commented Sep 11, 2019

Closes #1335

Async middleware where called:

  • once for the innermost subcommand (expected)
  • then once for every parent of this subcommand (unexpected)

Due to an incorrect check in the first run of middleware (before validation).

CI will probably fail as #1411 introduced a broken test in master.

@mleguen
Copy link
Member Author

mleguen commented Sep 11, 2019

Woops! Forgot to add a test to prove the issue is fixed, coming soon...

@mleguen
Copy link
Member Author

mleguen commented Sep 11, 2019

Ready for review!

@bcoe
Copy link
Member

bcoe commented Sep 12, 2019

@mleguen you're bitten by Node 6 not having async yet, switching to a promise should do the trick.

@mleguen
Copy link
Member Author

mleguen commented Sep 18, 2019

Thanks @bcoe

I knew it... :-)

It should be OK now.

@bcoe bcoe merged commit 9a42b63 into master Sep 18, 2019
@bcoe bcoe deleted the fix/1335 branch September 18, 2019 21:20
@bcoe
Copy link
Member

bcoe commented Oct 7, 2019

@mleguen released in yargs@14.2.0.

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.

Async middleware called twice
2 participants