Fix slideshow preloading logic to prevent redundant slide creation
This commit is contained in:
@@ -2437,6 +2437,8 @@ const SlideshowManager = {
|
||||
// Preload next slides
|
||||
for (let i = 1; i <= preloadCount; i++) {
|
||||
const nextIndex = (currentIndex + i) % totalItems;
|
||||
if (nextIndex === currentIndex) break;
|
||||
|
||||
const itemId = STATE.slideshow.itemIds[nextIndex];
|
||||
SlideCreator.createSlideForItemId(itemId);
|
||||
}
|
||||
@@ -2444,6 +2446,8 @@ const SlideshowManager = {
|
||||
// Preload previous slides
|
||||
for (let i = 1; i <= preloadCount; i++) {
|
||||
const prevIndex = (currentIndex - i + totalItems) % totalItems;
|
||||
if (prevIndex === currentIndex) break;
|
||||
|
||||
const prevItemId = STATE.slideshow.itemIds[prevIndex];
|
||||
SlideCreator.createSlideForItemId(prevItemId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user