diff --git a/packages/client/composables/useDynamicVirtualList.ts b/packages/client/composables/useDynamicVirtualList.ts new file mode 100644 index 0000000000..f1ac96e79a --- /dev/null +++ b/packages/client/composables/useDynamicVirtualList.ts @@ -0,0 +1,30 @@ +import type { UseVirtualListOptions } from '@vueuse/core' +import { debouncedWatch, useVirtualList } from '@vueuse/core' +import type { MaybeRef } from 'vue' +import { effectScope, shallowRef } from 'vue' + +/** + * `useVirtualList`'s `itemHeight` is not reactive, so we need to re-create the virtual list when the card height changes. + */ +export function useDynamicVirtualList(list: MaybeRef, getOptions: () => UseVirtualListOptions) { + type VirtualListReturn = ReturnType> + const virtualList = shallowRef() + debouncedWatch( + getOptions, + (options, _oldOptions, onCleanup) => { + const scope = effectScope() + scope.run(() => { + virtualList.value = useVirtualList( + list, + options, + ) + }) + onCleanup(() => scope.stop()) + }, + { + immediate: true, + debounce: 50, + }, + ) + return virtualList +} diff --git a/packages/client/internals/QuickOverview.vue b/packages/client/internals/QuickOverview.vue index 41f0db1d6a..5be7176d7d 100644 --- a/packages/client/internals/QuickOverview.vue +++ b/packages/client/internals/QuickOverview.vue @@ -1,12 +1,13 @@ @@ -109,47 +120,50 @@ watchEffect(() => { >
-
+
- - - - -
-
- - - {{ idx + 1 }} - + + + + +
+
+ + + {{ route.no }} + +
diff --git a/packages/client/pages/overview.vue b/packages/client/pages/overview.vue index 0d73696549..709af41e3d 100644 --- a/packages/client/pages/overview.vue +++ b/packages/client/pages/overview.vue @@ -1,10 +1,11 @@