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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user