Repository navigation
fix(web): show an empty state for libraries with no media - #1805
Conversation
A library with no items left the Recommended tab blank and showed the generic "No items found." on the Library tab, the same text as a filter that matches nothing. When every Recommended section resolves empty, or a Library browse comes back empty, the page now asks the catalog for one unfiltered item of the library (limit 1, no total). If there is none, both tabs show a shared empty-library panel; admins also get a "Scan library" action, a link to library management, and a scanning message while a scan of the library is active. If the library does hold items, the Library tab says no items match the current filters and offers to clear them. Closes Silo-Server#1794
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
| const browseCameBackEmpty = | ||
| !isGroupedAxis && !catalogQuery.isLoading && !catalogQuery.isError && totalItems === 0; | ||
| const libraryHasItemsQuery = useLibraryHasItems(libraryId, { enabled: browseCameBackEmpty }); |
There was a problem hiding this comment.
Missing empty-library state in web/src/pages/LibraryBrowse.tsx occurs because the !isGroupedAxis guard excludes audiobook Series, Authors, and Narrators views from the check, and their early return renders AudiobookGroupsView with only “No … found in this library.” Apply the library-presence check and shared empty state to empty grouped results so these views show “This library is empty” and the administrator scan action.
Prompt for LLM
File web/src/pages/LibraryBrowse.tsx:
Line 205 to 207:
Missing empty-library state in `web/src/pages/LibraryBrowse.tsx` occurs because the `!isGroupedAxis` guard excludes audiobook Series, Authors, and Narrators views from the check, and their early return renders `AudiobookGroupsView` with only “No … found in this library.” Apply the library-presence check and shared empty state to empty grouped results so these views show “This library is empty” and the administrator scan action.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
Not changing this here. The grouped Series, Authors and Narrators views are audiobook views, and audiobooks are a labeled beta that stays outside the 1.0 support promise. CLAUDE.md asks not to rework the Books beta for 1.0, so this PR keeps to movie and TV libraries, where !isGroupedAxis is always true. The grouped views keep their existing "No … found in this library" text.
There was a problem hiding this comment.
Understood—the suggestion is out of scope for this PR, not a required fix.
For movie and TV libraries, !isGroupedAxis does not exclude the new empty-state behavior. The grouped audiobook views can retain their existing messaging under the Books beta scope you described. This finding should not block #1805.
|
The PR's Suggested fix (PR-description line; no code diff): Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Problem
Closes #1794
Related issue: #1252
Validation tasks: changes #1252 C1
A library with no media had no empty state on the web. The Recommended tab showed nothing under the tab bar, and the Library tab said "No items found.", the same text as a filter that matches nothing, so users couldn't tell an empty library from an over-filtered one.
Both tabs now say "This library is empty". Admins also get a Scan library button and a link to library management, and see a scanning message while the library is being scanned. A non-empty library whose filters match nothing says "No items match your current filters." with Clear filters.
Approach
The page decides a library is empty only after its own results came back empty. It then asks the catalog for one unfiltered item (no total), so non-empty libraries make no extra request. The check respects the active profile, so a profile whose rating limits hide every title also sees the empty state. The panel reuses the Home empty-state style and the existing scan action.
Merge order with #1807
This PR and #1807 (#1793, request timeouts) edit the same lines in
web/src/pages/LibraryBrowse.tsxandweb/src/pages/LibraryRecommended.tsx. Each merges cleanly intomainon its own; the second one to land conflicts. Suggested order: this PR first, then #1807, which I'll rebase once this one is merged. The resolution is mechanical:LibraryBrowse.tsx: keep this PR'sbrowseCameBackEmpty/emptyStateblock, then fix(web): fail hung reads with a retryable error and keep sessions through outages #1807's retry andbrowseFailed/browsePartlyFailedlines (drop its duplicateisLoading). In the render, keep fix(web): fail hung reads with a retryable error and keep sessions through outages #1807's error branches and passemptyState={emptyState}toItemGrid.LibraryRecommended.tsx: put fix(web): fail hung reads with a retryable error and keep sessions through outages #1807'sisError && !dataerror return before this PR's empty-library return, and add!isErrortosectionsSettledEmptyso a failed layout doesn't trigger the emptiness check.An error must never fall through to an empty state; both PRs' tests check that once combined.
Validation
LibraryEmptyState,LibraryBrowse,LibraryRecommended,LibraryPageand the catalog hook pass; they cover an empty library on both tabs, filters matching nothing, loading, admin and non-admin variants, and a non-empty library being unchanged.make test-go. Its failures also occur on unmodifiedmainon this macOS host (hardware-acceleration probe tests whose fake ffmpeg is killed, andTestAdminResourceCapabilitiesAndScope); threejellycompattranscode-session tests that failed once under full-suite load pass in isolation on both. Linux CI is the authority for those.Risks
Regular users have no scan-status signal, so during a new library's first scan they see the empty state until items arrive. The iOS and Android phone apps have the same "No items found" ambiguity; that is a separate follow-up.
Checklist
AI Disclosure
main: the loading-to-empty transitions, that the emptiness check runs only after an empty result, profile access, and that non-admins send no admin requests. No findings.Note
Add dedicated empty state for libraries with no media
LibraryEmptyState, which shows different content for regular users and acting admins, plus admin actions to start a scan viauseScanLibraryor open library management. Accepted or running scans show a scanning message instead.useLibraryHasItems, an unfiltered one-item catalog query that reports whether a library contains any items (60s cache, disabled when library ID is invalid).LibraryBrowseshowsLibraryEmptyStatewhen the library is empty, and a newNoMatchingItemspanel with a Clear filters action when items exist but filters match nothing.LibraryRecommendedchecks the catalog only when all displayed sections resolve empty, then replaces the empty layout withLibraryEmptyState.ItemGridaccepts an optionalemptyStateReactNode prop that replaces the default "No items found." message.Macroscope summarized bb26dbf.