diff --git a/ui/src/lib/components/ListeningMode.svelte b/ui/src/lib/components/ListeningMode.svelte
index d20a754..6fd3681 100644
--- a/ui/src/lib/components/ListeningMode.svelte
+++ b/ui/src/lib/components/ListeningMode.svelte
@@ -256,6 +256,7 @@
transition: {isDragging ? 'none' : 'transform 0.32s cubic-bezier(0.32,0.72,0,1), opacity 0.32s ease'};
will-change: transform;
touch-action: pan-x;
+ pointer-events: auto;
"
ontouchstart={onTouchStart}
ontouchend={onTouchEnd}
diff --git a/ui/src/routes/+layout.svelte b/ui/src/routes/+layout.svelte
index dd37474..655c40a 100644
--- a/ui/src/routes/+layout.svelte
+++ b/ui/src/routes/+layout.svelte
@@ -954,7 +954,7 @@
{#if listeningModeOpen}
-
+
{ listeningModeOpen = false; listeningModeChapters = false; }}
openChapters={listeningModeChapters}
diff --git a/ui/src/routes/+page.svelte b/ui/src/routes/+page.svelte
index 60fc35d..0cda232 100644
--- a/ui/src/routes/+page.svelte
+++ b/ui/src/routes/+page.svelte
@@ -95,22 +95,28 @@
resetAutoAdvance();
}
- let autoAdvanceTimer = $state | null>(null);
-
- function resetAutoAdvance() {
- if (autoAdvanceTimer) clearInterval(autoAdvanceTimer);
- if (heroBooks.length > 1) {
- autoAdvanceTimer = setInterval(() => {
- heroIndex = (heroIndex + 1) % heroBooks.length;
- }, 6000);
- }
- }
+ // Auto-advance carousel every 6 s when there are multiple books.
+ // We use a $state counter as a "restart token" so the $effect can be
+ // re-triggered by manual navigation without reading heroIndex (which would
+ // cause an infinite loop when the interval itself mutates heroIndex).
+ let autoAdvanceSeed = $state(0);
$effect(() => {
- resetAutoAdvance();
- return () => { if (autoAdvanceTimer) clearInterval(autoAdvanceTimer); };
+ if (heroBooks.length <= 1) return;
+ // Subscribe to heroBooks.length and autoAdvanceSeed only — not heroIndex.
+ const len = heroBooks.length;
+ void autoAdvanceSeed; // track the seed
+ const id = setInterval(() => {
+ heroIndex = (heroIndex + 1) % len;
+ }, 6000);
+ return () => clearInterval(id);
});
+ function resetAutoAdvance() {
+ // Bump the seed to restart the interval after manual navigation.
+ autoAdvanceSeed++;
+ }
+
function playChapter(slug: string, chapter: number) {
audioStore.autoStartChapter = chapter;
goto(`/books/${slug}/chapters/${chapter}`);