@@ -125,7 +125,8 @@ const precisePriceFormatter = new Intl.NumberFormat('en-US', {
125125const visibleItems = computed (() => {
126126 const items = quotes .value ;
127127 if (! items .length ) return [];
128- return Array .from ({ length: renderedSlotCount .value }, (_ , offset ) => {
128+ const slotCount = Math .min (renderedSlotCount .value , items .length );
129+ return Array .from ({ length: slotCount }, (_ , offset ) => {
129130 const marketIndex = (windowStart .value + offset) % items .length ;
130131 const item = items[marketIndex];
131132 return formatMarketItem (item, {
@@ -152,7 +153,7 @@ const shouldAutoScroll = computed(() =>
152153 && ! isHovered .value
153154 && ! isPointerActive .value
154155 && selectedQuote .value === null
155- && quotes .value .length > 0
156+ && quotes .value .length > renderedSlotCount . value
156157);
157158
158159const trackStyle = computed (() => {
@@ -213,7 +214,8 @@ function getVisibleAssetSet(items = quotes.value) {
213214 const length = items .length ;
214215 const assets = new Set ();
215216 if (! length) return assets;
216- for (let offset = 0 ; offset < renderedSlotCount .value ; offset += 1 ) {
217+ const slotCount = Math .min (renderedSlotCount .value , length);
218+ for (let offset = 0 ; offset < slotCount; offset += 1 ) {
217219 const item = items[(windowStart .value + offset) % length];
218220 if (item? .asset ) {
219221 assets .add (item .asset );
@@ -325,7 +327,7 @@ function scheduleManualScrollEnd() {
325327}
326328
327329function onScrollIteration () {
328- if (! shouldAutoScroll .value || isManualScroll .value || ! quotes .value .length ) return ;
330+ if (! shouldAutoScroll .value || isManualScroll .value || quotes .value .length <= renderedSlotCount . value ) return ;
329331 windowStart .value = (windowStart .value + 1 ) % quotes .value .length ;
330332}
331333
0 commit comments