Skip to content

Commit 3fe1ded

Browse files
committed
fix: ensure we refetch when increasing results size
1 parent 510dc34 commit 3fe1ded

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/composables/npm/useNpmSearch.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,13 @@ export function useNpmSearch(
307307
)
308308

309309
// Re-search when provider changes
310-
watch(searchProvider, () => {
310+
watch(searchProvider, async () => {
311311
cache.value = null
312-
asyncData.refresh()
312+
await asyncData.refresh()
313+
const targetSize = toValue(options).size
314+
if (targetSize) {
315+
await fetchMore(targetSize)
316+
}
313317
})
314318

315319
// Computed data that uses cache

app/pages/search.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ defineOgImageComponent('Default', {
915915
</div>
916916

917917
<!-- No results found -->
918-
<div v-else-if="status !== 'pending'" role="status" class="py-12">
918+
<div v-else-if="status === 'success' || status === 'error'" role="status" class="py-12">
919919
<p class="text-fg-muted font-mono mb-6 text-center">
920920
{{ $t('search.no_results', { query }) }}
921921
</p>

0 commit comments

Comments
 (0)