You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Indicators causing bug in Carousel: "invalid array length" #2045
N/A - website is still in beta, not ready for launch/links
Description
Carousel appears to be working. When included, the indicator buttons do appear and work but also throw an error in the JS console. The arrows also work.
runtime-core.esm-bundler.js?v=87832025:1627
Uncaught (in promise) RangeError: Invalid array length
at renderList (runtime-core.esm-bundler.js?v=87832025:1627:11)
at Proxy._sfc_render (Carousel.vue:195:67)
at renderComponentRoot (runtime-core.esm-bundler.js?v=87832025:6286:16)
at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js?v=87832025:5044:26)
at ReactiveEffect.run (reactivity.esm-bundler.js?v=87832025:150:19)
at instance.update (runtime-core.esm-bundler.js?v=87832025:5097:17)
at callWithErrorHandling (runtime-core.esm-bundler.js?v=87832025:200:33)
at flushJobs (runtime-core.esm-bundler.js?v=87832025:413:9)
Hey there @ddavisj, you can fix the above issue by removing the v-slot="{ item }" from the UCarousel component.
Thanks @selemondev, I just tried removing this line and it broke the functionality. The images no longer appear at all. The error seems to act intermittently, it's not appearing - not sure why but will update this page if it reoccurs.
This issues seems to be caused by the pages property in Carousel.vue, and happens when the length of the items prop is less than the number of carousel pages.
The number of pages is calculated from the width of the carousel and each item, which can be set multiple ways such as :ui="{ item: 'basis-full md:basis-1/2 lg:basis-1/3' }" or <img :src="item" class="w-[400px]" draggable="false">
In my case I was using this carousel to show recently viewed products, however when you first enter the site you may only have one recently viewed product, and so this issue occurred.
I have also tried removing v-slot="{ item }" as above to no avail.
Activity
selemondev commentedon Aug 29, 2024
Hey there @ddavisj, you can fix the above issue by removing the
v-slot="{ item }"from theUCarouselcomponent.ddavisj commentedon Aug 30, 2024
Thanks @selemondev, I just tried removing this line and it broke the functionality. The images no longer appear at all. The error seems to act intermittently, it's not appearing - not sure why but will update this page if it reoccurs.
selemondev commentedon Aug 30, 2024
Hey there @ddavisj, here is an example of one:
starritree commentedon Oct 6, 2024
The problem was not solved. Does anyone have another solution?
SwoleRonson commentedon Oct 8, 2024
I have reproduced this below.
This issues seems to be caused by the pages property in Carousel.vue, and happens when the length of the items prop is less than the number of carousel pages.
The number of pages is calculated from the width of the carousel and each item, which can be set multiple ways such as
:ui="{ item: 'basis-full md:basis-1/2 lg:basis-1/3' }"or<img :src="item" class="w-[400px]" draggable="false">In my case I was using this carousel to show recently viewed products, however when you first enter the site you may only have one recently viewed product, and so this issue occurred.
I have also tried removing
v-slot="{ item }"as above to no avail.Something like this seems to fix it: