Skip to content

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
@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

3 participants