diff --git a/shopfloor-dashboard/index.html b/shopfloor-dashboard/index.html index e5eb38f..a4a0f59 100644 --- a/shopfloor-dashboard/index.html +++ b/shopfloor-dashboard/index.html @@ -867,18 +867,26 @@ // Store for carousel upcomingEvents = sortedUpcoming; + // Preserve current index if it's still valid, otherwise reset + if (currentUpcomingIndex >= sortedUpcoming.length) { + console.log(`Carousel: Index ${currentUpcomingIndex} out of range, resetting to 0`); + currentUpcomingIndex = 0; + } else { + console.log(`Carousel: Preserving index ${currentUpcomingIndex} across refresh`); + } + html += '