Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/Header/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const showSearchBar = computed(() => {
return route.name !== 'index'
})

const { model: searchQuery, flushUpdateUrlQuery } = useGlobalSearch()
const { model: searchQuery, flushUpdateUrlQuery } = useGlobalSearch('header')

function handleSubmit() {
flushUpdateUrlQuery()
Expand Down
4 changes: 2 additions & 2 deletions app/composables/useGlobalSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { debounce } from 'perfect-debounce'
// Pages that have their own local filter using ?q
const pagesWithLocalFilter = new Set(['~username', 'org'])

export function useGlobalSearch() {
export function useGlobalSearch(place: 'header' | 'content' = 'content') {
const { searchProvider } = useSearchProvider()
const searchProviderValue = computed(() => {
const p = normalizeSearchParam(route.query.p)
Expand Down Expand Up @@ -32,7 +32,7 @@ export function useGlobalSearch() {
const updateUrlQueryImpl = (value: string, provider: 'npm' | 'algolia') => {
const isSameQuery = route.query.q === value && route.query.p === provider
// Don't navigate away from pages that use ?q for local filtering
if (pagesWithLocalFilter.has(route.name as string) || isSameQuery) {
if ((pagesWithLocalFilter.has(route.name as string) && place === 'content') || isSameQuery) {
return
}

Expand Down
Loading