feature/backend-rewrite #2

Open
kamil wants to merge 236 commits from feature/backend-rewrite into main
2 changed files with 11 additions and 4 deletions
Showing only changes of commit 8de374cd35 - Show all commits

View File

@@ -46,8 +46,13 @@
// Keep nextChapter in the store so the layout's onended can navigate.
// Run as an effect so it stays in sync if the prop ever changes.
// On unmount, clear it so a stale value can't trigger navigation after
// the user leaves the chapter page.
$effect(() => {
audioStore.nextChapter = nextChapter ?? null;
return () => {
audioStore.nextChapter = null;
};
});
// Auto-start: if the layout navigated here via auto-next, kick off playback.
@@ -128,7 +133,7 @@
audioStore.bookTitle = bookTitle;
audioStore.voice = voice;
audioStore.speed = speed;
audioStore.nextChapter = nextChapter ?? null;
// nextChapter is kept in sync by the $effect above — no need to write it here
audioStore.status = 'loading';
audioStore.errorMsg = '';

View File

@@ -179,9 +179,11 @@
audioStore.isPlaying = false;
saveAudioTime();
if (audioStore.autoNext && audioStore.nextChapter !== null && audioStore.slug) {
audioStore.autoStartPending = true;
goto(`/books/${audioStore.slug}/chapters/${audioStore.nextChapter}`);
}
audioStore.autoStartPending = true;
goto(`/books/${audioStore.slug}/chapters/${audioStore.nextChapter}`).catch(() => {
audioStore.autoStartPending = false;
});
}
}}
preload="metadata"
style="display:none"