Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: search on collections > empty state ui (#2912)

Nivedin59a8a22e8ace
diff --git a/packages/hoppscotch-common/src/components/collections/MyCollections.vue b/packages/hoppscotch-common/src/components/collections/MyCollections.vue
index b5be43ca0..895dc1876 100644
--- a/packages/hoppscotch-common/src/components/collections/MyCollections.vue
+++ b/packages/hoppscotch-common/src/components/collections/MyCollections.vue
@@ -188,7 +188,16 @@
/>
</template>
<template #emptyNode="{ node }">
- <div v-if="node === null">
+ <div
+ v-if="filterText.length !== 0 && filteredCollections.length === 0"
+ class="flex flex-col items-center justify-center p-4 text-secondaryLight"
+ >
+ <icon-lucide-search class="pb-2 opacity-75 svg-icons" />
+ <span class="my-2 text-center">
+ {{ t("state.nothing_found") }} "{{ filterText }}"
+ </span>
+ </div>
+ <div v-else-if="node === null">
<div
class="flex flex-col items-center justify-center p-4 text-secondaryLight"
>
@@ -251,19 +260,6 @@
{{ t("empty.folder") }}
</span>
</div>
- <div
- v-if="
- filterText.length !== 0 &&
- filteredCollections.length === 0 &&
- node === null
- "
- class="flex flex-col items-center justify-center p-4 text-secondaryLight"
- >
- <icon-lucide-search class="pb-2 opacity-75 svg-icons" />
- <span class="my-2 text-center">
- {{ t("state.nothing_found") }} "{{ filterText }}"
- </span>
- </div>
</template>
</SmartTree>
</div>
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index 1c7482491..b84d75207 100644
--- a/packages/hoppscotch-common/src/components/collections/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/index.vue
@@ -437,6 +437,7 @@ const filteredCollections = computed(() => {
if (isMatch(request.name)) filteredRequests.push(request)
}
for (const folder of collection.folders) {
+ if (isMatch(folder.name)) filteredFolders.push(folder)
const filteredFolderRequests = []
for (const request of folder.requests) {
if (isMatch(request.name)) filteredFolderRequests.push(request)