@@ -4,7 +4,7 @@ import { debounce } from 'perfect-debounce'
44// Pages that have their own local filter using ?q
55const pagesWithLocalFilter = new Set ( [ '~username' , 'org' ] )
66
7- export function useGlobalSearch ( ) {
7+ export function useGlobalSearch ( place : 'header' | 'content' = 'content' ) {
88 const { searchProvider } = useSearchProvider ( )
99 const searchProviderValue = computed ( ( ) => {
1010 const p = normalizeSearchParam ( route . query . p )
@@ -32,7 +32,7 @@ export function useGlobalSearch() {
3232 const updateUrlQueryImpl = ( value : string , provider : 'npm' | 'algolia' ) => {
3333 const isSameQuery = route . query . q === value && route . query . p === provider
3434 // Don't navigate away from pages that use ?q for local filtering
35- if ( pagesWithLocalFilter . has ( route . name as string ) || isSameQuery ) {
35+ if ( ( pagesWithLocalFilter . has ( route . name as string ) && place === 'content' ) || isSameQuery ) {
3636 return
3737 }
3838
@@ -64,6 +64,7 @@ export function useGlobalSearch() {
6464 get : ( ) => searchQuery . value ,
6565 set : async ( value : string ) => {
6666 searchQuery . value = value
67+ console . log ( 'searchQueryValue' , value , updateUrlQuery . isPending ( ) )
6768
6869 // Leading debounce implementation as it doesn't work properly out of the box (https://github.com/unjs/perfect-debounce/issues/43)
6970 if ( ! updateUrlQuery . isPending ( ) ) {
0 commit comments