appstore: library loading goes through the scaffold
- Commit
16f2d62b526b57881d9f6ed9e082269b2bbb33c8- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-23 00:49 UTC (13 days ago)
- Parents
988c731
LibraryScreen's whole-content loader moves to AppScaffold(isLoading = !hasLoaded && apps.isEmpty()). The chips only filter a loaded list (counts are zero before the first sweep), so nothing meaningful is hidden; hasLoaded never resets, so later filtering keeps chips composed. Two regression tests pin first-load chip hiding and loaded-filter chip retention. Verified: lintVitalRelease (ScaffoldLoading green), LibraryScreenTest, compile.
Diff
appstore/src/main/java/com/vayunmathur/appstore/ui/LibraryScreen.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/ui/LibraryScreen.kt b/appstore/src/main/java/com/vayunmathur/appstore/ui/LibraryScreen.ktindex 07c3f6350d..f9ec54b6a7 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/ui/LibraryScreen.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/ui/LibraryScreen.kt@@ -23,7 +23,6 @@ import androidx.compose.ui.unit.dp import com.vayunmathur.appstore.data.UnifiedApp import com.vayunmathur.appstore.platform.AppStoreViewModel import com.vayunmathur.library.ui.EmptyState-import com.vayunmathur.library.ui.LoadingState import com.vayunmathur.library.ui.FilterChip import com.vayunmathur.library.ui.IconPackage import com.vayunmathur.library.ui.AppScaffold@@ -41,7 +40,14 @@ fun LibraryScreen( actions: LibraryActions, onAppClick: (UnifiedApp) -> Unit = {}, ) {- AppScaffold(topBar = {}) { padding ->+ // Whole-content loading: the list IS the content and the chips only filter a+ // loaded list, so there is no meaningful filter state before the first sweep.+ // isLoading is gated on hasLoaded, which never resets, so filtering a loaded+ // library (even down to empty) keeps the chips visible above the empty state.+ AppScaffold(+ topBar = {},+ isLoading = !state.hasLoaded && state.apps.isEmpty(),+ ) { padding -> Column(Modifier.fillMaxSize().padding(top = padding.calculateTopPadding())) { LazyRow( Modifier.fillMaxWidth(),@@ -65,9 +71,7 @@ fun LibraryScreen( } } - if (!state.hasLoaded && state.apps.isEmpty()) {- LoadingState(Modifier.fillMaxSize())- } else if (state.apps.isEmpty()) {+ if (state.apps.isEmpty()) { EmptyState( title = stringResource(R.string.library_empty_title), message = stringResource(R.string.library_empty_message),
appstore/src/test/java/com/vayunmathur/appstore/ui/LibraryScreenTest.kt
diff --git a/appstore/src/test/java/com/vayunmathur/appstore/ui/LibraryScreenTest.kt b/appstore/src/test/java/com/vayunmathur/appstore/ui/LibraryScreenTest.ktindex 61a11a3d24..fbc14860ac 100644--- a/appstore/src/test/java/com/vayunmathur/appstore/ui/LibraryScreenTest.kt+++ b/appstore/src/test/java/com/vayunmathur/appstore/ui/LibraryScreenTest.kt@@ -68,4 +68,33 @@ class LibraryScreenTest { rule.onNodeWithText("F-Droid", substring = true).performClick() assertEquals(SourceFilter.FDROID, filter) }++ @Test+ fun `first load hides the filter chips behind the spinner`() {+ val state = LibraryUiState(hasLoaded = false)+ rule.setContent { LibraryScreen(state = state, actions = LibraryActions.Noop) }++ rule.onNodeWithText("F-Droid", substring = true).assertDoesNotExist()+ }++ @Test+ fun `filtering a loaded library down to empty keeps the chips`() {+ var filter: SourceFilter? = null+ val actions = object : LibraryActions {+ override fun setLibraryFilter(f: SourceFilter) {+ filter = f+ }+ }+ // hasLoaded stays true after the first sweep, so a filter with no rows+ // shows the empty state under still-visible chips, never the spinner.+ val state = LibraryUiState(+ hasLoaded = true,+ counts = mapOf(SourceFilter.ALL to 1, SourceFilter.FDROID to 1, SourceFilter.PLAYSTORE to 0),+ )+ rule.setContent { LibraryScreen(state = state, actions = actions) }++ rule.onNodeWithText("Play Store", substring = true).assertIsDisplayed()+ rule.onNodeWithText("F-Droid", substring = true).performClick()+ assertEquals(SourceFilter.FDROID, filter)+ } }