Skip to content

Commit c0a11fd

Browse files
authored
fix: deduplicate packages in user packages page. (#592)
1 parent f5ae776 commit c0a11fd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

app/composables/useNpmRegistry.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,11 @@ export function useNpmSearch(
382382

383383
// Update cache
384384
if (cache.value && cache.value.query === q) {
385+
const existingNames = new Set(cache.value.objects.map(obj => obj.package.name))
386+
const newObjects = response.objects.filter(obj => !existingNames.has(obj.package.name))
385387
cache.value = {
386388
query: q,
387-
objects: [...cache.value.objects, ...response.objects],
389+
objects: [...cache.value.objects, ...newObjects],
388390
total: response.total,
389391
}
390392
} else {

0 commit comments

Comments
 (0)