Skip to content

Commit 17640fe

Browse files
committed
perf(package-list): use shallowRef instead deep ref
1 parent df05aba commit 17640fe

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

app/components/PackageList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const emit = defineEmits<{
3232
}>()
3333
3434
// Reference to WindowVirtualizer for infinite scroll detection
35-
const listRef = ref<WindowVirtualizerHandle>()
35+
const listRef = useTemplateRef<WindowVirtualizerHandle>('listRef')
3636
3737
// Set up infinite scroll if hasMore is provided
3838
const hasMore = computed(() => props.hasMore ?? false)
@@ -52,7 +52,7 @@ const { handleScroll, scrollToPage } = useVirtualInfiniteScroll({
5252
})
5353
5454
// Scroll to initial page once list is ready and has items
55-
const hasScrolledToInitial = ref(false)
55+
const hasScrolledToInitial = shallowRef(false)
5656
5757
watch(
5858
[() => props.results.length, () => props.initialPage, listRef],

app/composables/useVirtualInfiniteScroll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface WindowVirtualizerHandle {
1313

1414
export interface UseVirtualInfiniteScrollOptions {
1515
/** Reference to the WindowVirtualizer component */
16-
listRef: Ref<WindowVirtualizerHandle | undefined>
16+
listRef: Ref<WindowVirtualizerHandle | null>
1717
/** Current item count */
1818
itemCount: Ref<number>
1919
/** Whether there are more items to load */

0 commit comments

Comments
 (0)