Skip to content

Commit a474a09

Browse files
[Manager] Fix search results render incorrectly when scrolling pages then changing query or tab (#3879)
1 parent bc360ee commit a474a09

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/components/dialog/content/manager/ManagerDialogContent.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
/>
5656
<div v-else class="h-full" @click="handleGridContainerClick">
5757
<VirtualGrid
58+
id="results-grid"
5859
:items="resultsWithKeys"
5960
:buffer-rows="3"
6061
:grid-style="GRID_STYLE"
@@ -92,7 +93,7 @@
9293
import { whenever } from '@vueuse/core'
9394
import { merge } from 'lodash'
9495
import Button from 'primevue/button'
95-
import { computed, onUnmounted, ref, watch } from 'vue'
96+
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
9697
import { useI18n } from 'vue-i18n'
9798
9899
import ContentDivider from '@/components/common/ContentDivider.vue'
@@ -199,6 +200,10 @@ const {
199200
const filterMissingPacks = (packs: components['schemas']['Node'][]) =>
200201
packs.filter((pack) => !comfyManagerStore.isPackInstalled(pack.id))
201202
203+
whenever(selectedTab, () => {
204+
pageNumber.value = 0
205+
})
206+
202207
const isUpdateAvailableTab = computed(
203208
() => selectedTab.value?.id === ManagerTab.UpdateAvailable
204209
)
@@ -419,6 +424,17 @@ whenever(selectedNodePack, async () => {
419424
}
420425
})
421426
427+
let gridContainer: HTMLElement | null = null
428+
onMounted(() => {
429+
gridContainer = document.getElementById('results-grid')
430+
})
431+
watch(searchQuery, () => {
432+
gridContainer ??= document.getElementById('results-grid')
433+
if (gridContainer) {
434+
gridContainer.scrollTop = 0
435+
}
436+
})
437+
422438
onUnmounted(() => {
423439
getPackById.cancel()
424440
})

0 commit comments

Comments
 (0)