Skip to content

Fix: Load library tabs by identifier and add missing import#218

Merged
theovilardo merged 1 commit intomasterfrom
fix-library-tab-loading-logic
Oct 9, 2025
Merged

Fix: Load library tabs by identifier and add missing import#218
theovilardo merged 1 commit intomasterfrom
fix-library-tab-loading-logic

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

This commit addresses two issues identified during a code review:

  1. The onLibraryTabSelected function was using hard-coded numeric indices to trigger lazy loading for library tabs. This caused a bug where reordering tabs would result in incorrect content being loaded (e.g., clicking on the "Albums" tab would load songs). The logic has been refactored to use the stable string identifier of the tab (e.g., "SONGS", "ALBUMS") to ensure the correct data is always loaded, regardless of tab order. The _loadedTabs state has been updated accordingly to store string identifiers instead of integer indices.

  2. A missing kotlinx.serialization.decodeFromString import was causing a compilation error. The import has been added to resolve this issue.

This commit addresses two issues identified during a code review:

1. The `onLibraryTabSelected` function was using hard-coded numeric indices to trigger lazy loading for library tabs. This caused a bug where reordering tabs would result in incorrect content being loaded (e.g., clicking on the "Albums" tab would load songs). The logic has been refactored to use the stable string identifier of the tab (e.g., "SONGS", "ALBUMS") to ensure the correct data is always loaded, regardless of tab order. The `_loadedTabs` state has been updated accordingly to store string identifiers instead of integer indices.

2. A missing `kotlinx.serialization.decodeFromString` import was causing a compilation error. The import has been added to resolve this issue.
@theovilardo theovilardo merged commit cdbcacf into master Oct 9, 2025
@theovilardo theovilardo deleted the fix-library-tab-loading-logic branch October 9, 2025 18:57
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.

1 participant