HiDeoo / starlight-package-managers

Quickly display npm related commands for multiple package managers in your Starlight documentation site
https://starlight-package-managers.vercel.app
MIT License
22 stars 3 forks source link

Persist pkg manager choice between pages #3

Closed KubaJastrz closed 1 year ago

KubaJastrz commented 1 year ago

Is your feature request related to a problem?

I have to pick the package manager every time, whenever I'm switching between Starlight pages.

Describe the solution you'd like

Save my choice in localStorage and read on component init.

Describe alternatives you've considered

No response

Additional Context

No response

HiDeoo commented 1 year ago

Thanks for your feedback.

This is correct, at the moment, the behavior is identical to the one in the Astro documentation, e.g. if you navigate to this page, select Yarn and navigate to this other page.

I plan on potentially adding support for persisting the package manager choice in local storage using an explicit different import, e.g. import { PersistentPackageManagers } from 'starlight-package-managers' instead of import { PackageManagers } from 'starlight-package-managers', altho this is something I want to tackle after synced tabs land in Starlight as this would remove a huge portion of code from this component and make refactoring easier.

As this is something I am planning and already tracking, I'll close this issue but I'll make sure to ping it when I have updates.