Skip to content

fix(web): show an empty state for libraries with no media - #1805

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/empty-library-state
Oct 3, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/empty-library-state

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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.tsx and web/src/pages/LibraryRecommended.tsx. Each merges cleanly into main on 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:

An error must never fall through to an empty state; both PRs' tests check that once combined.

Validation

  • New and existing tests for LibraryEmptyState, LibraryBrowse, LibraryRecommended, LibraryPage and 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.
  • Manual, web app against a Docker build of these fixes: an empty TV library showed the empty state on both tabs with Scan library and Manage libraries for the admin; a filter matching nothing in a populated library showed the filter message and Clear filters.
  • The full gate from CONTRIBUTING.md ran on a branch combining all nine Series — Web #1252 fixes, including this PR merged with fix(web): fail hung reads with a retryable error and keep sessions through outages #1807: every step passes except make test-go. Its failures also occur on unmodified main on this macOS host (hardware-acceleration probe tests whose fake ffmpeg is killed, and TestAdminResourceCapabilitiesAndScope); three jellycompat transcode-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

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (running in T3 Code)
  • Tool(s): Claude Code (Bash, Read, Edit, Write, sub-agents, browser automation through the T3 Code preview), GitHub CLI, Docker, FFmpeg
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: An independent Claude Code review agent (claude-opus-5-5) checked the diff against 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

  • Adds LibraryEmptyState, which shows different content for regular users and acting admins, plus admin actions to start a scan via useScanLibrary or open library management. Accepted or running scans show a scanning message instead.
  • Adds useLibraryHasItems, an unfiltered one-item catalog query that reports whether a library contains any items (60s cache, disabled when library ID is invalid).
  • LibraryBrowse shows LibraryEmptyState when the library is empty, and a new NoMatchingItems panel with a Clear filters action when items exist but filters match nothing.
  • LibraryRecommended checks the catalog only when all displayed sections resolve empty, then replaces the empty layout with LibraryEmptyState.
  • ItemGrid accepts an optional emptyState ReactNode prop that replaces the default "No items found." message.
  • Behavioral Change: empty non-grouped browse and fully empty recommended views now wait on an extra catalog query before rendering content.

Macroscope summarized bb26dbf.

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
@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 0abd7cc0-a8e4-4c1c-9ab4-2a72547fc8d8

📥 Commits

Reviewing files that changed from the base of the PR and between 4a0cff4 and bb26dbf.

📒 Files selected for processing (9)
  • web/src/components/ItemGrid.tsx
  • web/src/components/LibraryEmptyState.test.tsx
  • web/src/components/LibraryEmptyState.tsx
  • web/src/hooks/queries/catalog.test.tsx
  • web/src/hooks/queries/catalog.ts
  • web/src/pages/LibraryBrowse.test.tsx
  • web/src/pages/LibraryBrowse.tsx
  • web/src/pages/LibraryRecommended.test.tsx
  • web/src/pages/LibraryRecommended.tsx
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Comment on lines +205 to +207
const browseCameBackEmpty =
!isGroupedAxis && !catalogQuery.isLoading && !catalogQuery.isError && totalItems === 0;
const libraryHasItemsQuery = useLibraryHasItems(libraryId, { enabled: browseCameBackEmpty });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026

Copy link
Copy Markdown

The PR's Validation tasks: unblocks #1252 C1 line does not match the task record: Series — Web #1252 still lists C1 as Not run, with no failed or blocked result. Issue #1794 says the issue was observed while exercising C1, but that finding is not recorded on the task. Please use Validation tasks: changes #1252 C1, or record the blocking finding on #1252 before calling it unblocked.

Suggested fix (PR-description line; no code diff): Validation tasks: changes #1252 C1

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Empty library shows a blank Recommended tab and the generic "No items found."

2 participants