|
55 | 55 | /> |
56 | 56 | <div v-else class="h-full" @click="handleGridContainerClick"> |
57 | 57 | <VirtualGrid |
| 58 | + id="results-grid" |
58 | 59 | :items="resultsWithKeys" |
59 | 60 | :buffer-rows="3" |
60 | 61 | :grid-style="GRID_STYLE" |
|
92 | 93 | import { whenever } from '@vueuse/core' |
93 | 94 | import { merge } from 'lodash' |
94 | 95 | import Button from 'primevue/button' |
95 | | -import { computed, onUnmounted, ref, watch } from 'vue' |
| 96 | +import { computed, onMounted, onUnmounted, ref, watch } from 'vue' |
96 | 97 | import { useI18n } from 'vue-i18n' |
97 | 98 |
|
98 | 99 | import ContentDivider from '@/components/common/ContentDivider.vue' |
@@ -199,6 +200,10 @@ const { |
199 | 200 | const filterMissingPacks = (packs: components['schemas']['Node'][]) => |
200 | 201 | packs.filter((pack) => !comfyManagerStore.isPackInstalled(pack.id)) |
201 | 202 |
|
| 203 | +whenever(selectedTab, () => { |
| 204 | + pageNumber.value = 0 |
| 205 | +}) |
| 206 | +
|
202 | 207 | const isUpdateAvailableTab = computed( |
203 | 208 | () => selectedTab.value?.id === ManagerTab.UpdateAvailable |
204 | 209 | ) |
@@ -419,6 +424,17 @@ whenever(selectedNodePack, async () => { |
419 | 424 | } |
420 | 425 | }) |
421 | 426 |
|
| 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 | +
|
422 | 438 | onUnmounted(() => { |
423 | 439 | getPackById.cancel() |
424 | 440 | }) |
|
0 commit comments