Skip to content

fix(docs): update VariantItem link implementation and separate CLI version docs Closes npm/cli#8414 #1659

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 2 commits into
base: main
Choose a base branch
from

Conversation

Mohit5Upadhyay
Copy link
Contributor

Description

This PR addresses npm/cli#8414, which reports that switching versions using the CLI version dropdown does not properly update the displayed documentation.

Changes

  • Refactored VariantItem component:

These changes ensure that when users switch CLI versions from the dropdown, the documentation updates correctly to display the appropriate content for each version.


Updated

docs-version-updated-npm.mp4

References

Closes npm/cli#8414

@Mohit5Upadhyay
Copy link
Contributor Author

Hi @leobalter and @wraithgar!

This PR fixes the dropdown issue from npm/cli#8414.
I’d love your feedback and am happy to make further improvements if needed.

Thanks for your time and review!

@owlstronaut owlstronaut self-assigned this Jul 8, 2025
@owlstronaut owlstronaut self-requested a review July 8, 2025 18:14
Copy link
Contributor

@owlstronaut owlstronaut left a comment

Choose a reason for hiding this comment

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

@Mohit5Upadhyay this is a great start -- It fixes the real bug.

Issue found during testing: The dropdown no longer closes when selecting a version. The navigation works correctly, but the dropdown stays open.

To reproduce:

  1. Open CLI version dropdown
  2. Select a different version
  3. Notice dropdown remains open

This worked in the original implementation because ActionList.Item handled both navigation and closing. With the new nested structure, we've lost the auto-close behavior.

Additional, now you are familiar with the linting on the project 😄

@Mohit5Upadhyay Mohit5Upadhyay requested a review from a team as a code owner July 11, 2025 07:34
@Mohit5Upadhyay
Copy link
Contributor Author

Hi @owlstronaut! 👋

Thanks so much for your feedback.

I’ve updated the implementation to close the dropdown when switching versions by using useLocationChange and a useEffect to handle navigation changes. This should restore the expected auto-close behavior you pointed out.
I’ve also run Prettier to ensure everything is properly formatted.

Updated

dropdownbox-close-version-change.mp4

Let me know if there’s anything else I should tweak or improve!
Thanks again for your thorough review. 🚀

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.

[BUG] : Documentation should be updated as per the Selected Option from the dropdown menu
2 participants