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

Fixes yarn why -R #6251

Merged
merged 3 commits into from May 6, 2024
Merged

Fixes yarn why -R #6251

merged 3 commits into from May 6, 2024

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Apr 26, 2024

What's the problem this PR addresses?

When using the -R flag on a flag with a large amount of workspaces, yarn why may fail to return enough information to answer the question "why is this package here". This is because of a bug in the implementation where we decline to print a package in the tree view if:

  • We saw it before, or
  • It's a workspace (because we'll print it later anyway)

However we check the first condition first and we put the package in the "seen" list before we check whether it's a workspace. As a result, workspaces that are dependencies of other workspaces won't have their dependencies shown.

How did you fix it?

Flipped the two conditions.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@merceyz
Copy link
Member

merceyz commented Apr 26, 2024

Could you add a test for this?

@arcanis arcanis merged commit 3a74ca9 into master May 6, 2024
22 of 26 checks passed
@arcanis arcanis deleted the mael/yarn-why-fix branch May 6, 2024 13:02
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