refactor: simplify after self-review
- drop the redundant isLoadingMore boolean from the background-loading
store; derive from inFlight > 0 in the selector
- pull _active_source_root_paths out of get_library_stats and reuse it
from get_duplicate_groups (same is_active + admin-scope check, now
in one place)
- drop p.rstrip('/') in the duplicates folder-scope filter (SourceRoot
paths are never written with a trailing slash)
- match Timeline's initial-load affordance to the new bottom indicator
(Loader2 spinner + ellipsis instead of plain "Loading photos...")
- trim narrative comments that explained what the surrounding code does
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -199,10 +199,6 @@ export function Timeline() {
|
||||
// Shared photos query — both Timeline and PreviewView use the same hook so
|
||||
// they share one cache entry, regardless of filter state.
|
||||
const { data: photos = [], isLoading } = usePhotosQuery()
|
||||
// Background cursor loop (after the initial page resolves) still
|
||||
// streaming more photos? Drives the bottom-of-grid spinner so the
|
||||
// user has a signal that more results are on the way and a sudden
|
||||
// "end of list" is real rather than mid-fetch.
|
||||
const isLoadingMore = usePhotosLoadingMore()
|
||||
|
||||
// Tracks the previous viewMode so the "preview just closed" scroll
|
||||
@@ -736,8 +732,9 @@ export function Timeline() {
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-full">
|
||||
<div className="text-text-muted">Loading photos...</div>
|
||||
<div className="flex h-full items-center justify-center gap-2 text-text-muted">
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
Loading photos…
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -794,11 +791,7 @@ export function Timeline() {
|
||||
position: 'relative',
|
||||
}}
|
||||
>
|
||||
{/* Bottom loading indicator. Positioned absolutely just below
|
||||
* the virtualizer's last row so a mid-grid spinner doesn't
|
||||
* jitter the layout when pages flip. Sits inside the same
|
||||
* positioned wrapper that hosts the virtual items so the
|
||||
* parent's translate space stays self-contained. */}
|
||||
{/* Absolute-positioned so layout doesn't jitter when pages flip. */}
|
||||
{isLoadingMore && photos.length > 0 && (
|
||||
<div
|
||||
className="pointer-events-none absolute left-0 right-0 flex items-center justify-center gap-2 py-4 text-xs text-text-muted"
|
||||
|
||||
Reference in New Issue
Block a user