Skip to content

Commit c32e845

Browse files
committed
refactor: update the relevant components to use the new stripped query
1 parent cd01091 commit c32e845

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

app/pages/search.vue

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ const parsedQuery = computed(() => {
5151
return { scope: scope ?? null, name: name, version: version || null, strippedQuery }
5252
})
5353
54+
const packageScope = computed(() => parsedQuery.value.scope)
55+
const strippedQuery = computed(() => parsedQuery.value.strippedQuery)
56+
5457
// Track if page just loaded (for hiding "Searching..." during view transition)
5558
const hasInteracted = shallowRef(false)
5659
onMounted(() => {
@@ -210,7 +213,7 @@ const {
210213
suggestions: validatedSuggestions,
211214
packageAvailability,
212215
} = useSearch(
213-
query,
216+
strippedQuery,
214217
searchProvider,
215218
() => ({
216219
size: requestedSize.value,
@@ -305,14 +308,6 @@ const isValidPackageName = computed(() => isValidNewPackageName(query.value.trim
305308
// Get connector state
306309
const { isConnected, npmUser, listOrgUsers } = useConnector()
307310
308-
// Check if this is a scoped package and extract scope
309-
const packageScope = computed(() => {
310-
const q = query.value.trim()
311-
if (!q.startsWith('@')) return null
312-
const match = q.match(/^@([^/]+)\//)
313-
return match ? match[1] : null
314-
})
315-
316311
// Track org membership for scoped packages
317312
const orgMembership = ref<Record<string, boolean>>({})
318313
@@ -685,7 +680,7 @@ defineOgImageComponent('Default', {
685680
<!-- No results found -->
686681
<div v-else-if="status === 'success' || status === 'error'" role="status" class="py-12">
687682
<p class="text-fg-muted font-mono mb-6 text-center">
688-
{{ $t('search.no_results', { query }) }}
683+
{{ $t('search.no_results', { query: strippedQuery }) }}
689684
</p>
690685

691686
<!-- User/Org suggestions when no packages found -->

0 commit comments

Comments
 (0)