feat: show books as an import adds them, not once it ends

Refresh the list every couple of seconds while the queue runs, holding off
while the reader has scrolled past the first page.
This commit is contained in:
2026-08-17 11:21:49 -04:00
parent 7e33a8fe05
commit 85367daf7e
3 changed files with 65 additions and 0 deletions
@@ -5,6 +5,7 @@
import type { PaginatedResponse } from '$lib/schema/common';
import { setBookCollectionState } from '$lib/state/bookCollection.svelte';
import { getBookOperationsState } from '$lib/state/bookOperations.svelte';
import { getUploadQueueState } from '$lib/state/upload-queue.svelte';
import { untrack } from 'svelte';
let {
@@ -23,6 +24,16 @@
const bookOps = getBookOperationsState();
const bookCollection = setBookCollectionState(bookOps, books, filterData);
const queue = getUploadQueueState();
// An upload refreshes this list every couple of seconds so books show up as
// they land. That refresh returns the first page, so it waits while the reader
// is reading further down. Cleared on the way out: this list is gone, and a
// stale hold would stop the next one refreshing at all.
$effect(() => {
queue.holdRefresh = bookCollection.pastFirstPage;
return () => (queue.holdRefresh = false);
});
let skip = $state(true);