File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ export const useSelectedPackageManager = createSharedComposable(
1212
1313 // Sync to data-pm attribute on the client
1414 if ( import . meta. client ) {
15+ const queryPM = new URLSearchParams ( window . location . search ) . get ( 'pm' )
16+ if ( queryPM && packageManagers . some ( pm => pm . id === queryPM ) ) {
17+ pm . value = queryPM as PackageManagerId
18+ }
1519 // Watch for changes and update the attribute
1620 watch (
1721 pm ,
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export function initPreferencesOnPrehydrate() {
4242 let pm = 'npm'
4343
4444 // Support package manager preference in query string (for example, ?pm=pnpm)
45- const queryPM = new URLSearchParams ( document . location . search ) . get ( 'pm' )
45+ const queryPM = new URLSearchParams ( window . location . search ) . get ( 'pm' )
4646 if ( queryPM && validPMs . has ( queryPM ) ) {
4747 pm = queryPM
4848 localStorage . setItem ( 'npmx-pm' , pm )
You can’t perform that action at this time.
0 commit comments