Skip to content

fix(library) - Audio Library Issues - #1078

Merged
RadicalMuffinMan merged 3 commits into
Moonfin-Client:mainfrom
mattsigal:fix/songs-library-lazy-load-search-safeguards
Aug 7, 2026
Merged

fix(library) - Audio Library Issues#1078
RadicalMuffinMan merged 3 commits into
Moonfin-Client:mainfrom
mattsigal:fix/songs-library-lazy-load-search-safeguards

Conversation

@mattsigal

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

This is similar to #1075 but specifically targets Audio libraries. As noticed during testing, these libraries were jamming up the UI (especially the Songs tab) with way too many requests. This PR optimizes library browse pagination and alphabet letter jump performance for audio libraries.

Specifically it implements nameLessThan offset lookups (15ms total query time) for letter jump indexing, eliminates UI thread thrashing by suppressing intermediate notifyListeners() calls during batch page loads, and replaces deadlocking post-frame listeners with explicit frame scheduling completer callbacks.

The outcome is: for artists and albums, both letter jump and search are fully functional and responsive. For songs libraries, however, search works great but the letter jump is not really amenable here and so this PR hides the alphabet picker bar instead of having it be visible but broken.

Related Issues

Link related issues or tickets separated by commas.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • UI/UX update
  • Documentation update
  • Build/CI change
  • Other (describe):

Changes Made

List the key changes included in this PR.

  • library_browse_view_model.dart: Integrated Jellyfin API's native nameLessThan parameter in _countItemsBeforeLetter() for O(1) 15ms letter index offset calculation; updated loadMore() with notify: false parameter during batch scans to prevent main thread widget rebuild thrashing; extracted _resolveTypeFilters() helper.
  • library_browse_screen.dart: Replaced WidgetsBinding.instance.endOfFrame with _waitForFrame() helper using scheduleFrame() and addPostFrameCallback completer to eliminate frame deadlocks; added 15-second timeout safeguard to _jumpToLetter(); updated _LibraryHeader to hide the alphabet jump bar on Songs view (onShuffle != null).
  • item_detail_screen.dart: Exported TrackTile for shared track row rendering consistency.

Platform

  • Android
  • iOS
  • tvOS
  • Web
  • macOS
  • Windows
  • Linux
  • All / Shared code

Testing

Describe how this change was tested.

  • Tested on emulator / simulator
  • Tested on physical device
  • Manual testing completed
  • Not tested (explain why):

Test Steps

  1. Navigate to Audio -> Artists or Albums in a large library (30,000+ items).
  2. Tap any letter button (e.g., 'B' or 'D'). Verify the loading overlay opens and closes in ~165ms and the scroll viewport jumps directly to the selected letter.
  3. Open Audio -> Songs. Verify the letter jump bar is hidden and Search/Sort/Shuffle header remains fully functional.

Screenshots (if applicable)

Include screenshots or recordings for UI changes.

Checklist

  • Code builds successfully
  • Code follows project style and conventions
  • No unnecessary commented-out code
  • No new warnings introduced

…uerying

- Optimize library browse viewmodel with server-side nameLessThan offset lookup for 15ms letter indexing.
- Prevent UI thread thrashing by suppressing notifyListeners during batch page loads.
- Replace endOfFrame listener with scheduleFrame post-frame completer callback in library browse screen.
- Hide alphabet jump bar on Songs browse view while keeping it active for Albums and Artists.
- Export TrackTile widget for reusable track list rendering.
…y-load-search-safeguards

# Conflicts:
#	lib/data/viewmodels/library_browse_view_model.dart
#	lib/ui/screens/browse/library_browse_screen.dart
@RadicalMuffinMan
RadicalMuffinMan merged commit 847b0c7 into Moonfin-Client:main Aug 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants