Modern Apps git

← Modern-Apps.git

search: real no-results and error states in shop and uniflix

Commit
787dd4d85496199084b177c8c285b096ccca2e60
Author
Vayun Mathur <[email protected]>
When
2026-11-21 11:21 UTC (15 days ago)
Parents
2c5812f
Shop search rendered loading, no-query, zero-results and
failure identically ('No products found'), and failures had
no retry. The four states are now distinct: initial hint,
no-results EmptyState echoing the submitted query, and an
ErrorState rendering the stored error verbatim with retry.
The ViewModel tracks the submitted query so typing alone
never shows no-results. Uniflix phone search rendered a blank
grid for zero matches; it now shows the shared EmptyState
with the query echoed (TV already had one), never while
loading or for a blank query.

Verified: shop 152 and uniflix 214 tests pass.

Diff

shop/src/main/java/com/vayunmathur/shop/data/CheckoutIntentStore.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/data/CheckoutIntentStore.kt b/shop/src/main/java/com/vayunmathur/shop/data/CheckoutIntentStore.ktnew file mode 100644index 0000000000..977cedc314--- /dev/null+++ b/shop/src/main/java/com/vayunmathur/shop/data/CheckoutIntentStore.kt@@ -0,0 +1,78 @@+package com.vayunmathur.shop.data++import android.content.Context+import androidx.core.content.edit+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.sync.Mutex+import kotlinx.coroutines.sync.withLock+import kotlinx.coroutines.withContext+import kotlinx.serialization.Serializable+import kotlinx.serialization.encodeToString+import kotlinx.serialization.json.Json++/**+ * A checkout write whose intent (idempotency key) was persisted BEFORE the write,+ * so process death mid-create cannot lose it and a later launch cannot mint a+ * second intent/session for the same cart.+ *+ * The backend can fetch a session by checkout id (`getCheckout`) and poll order+ * tracking by token, but it has no query-by-intent: an [InFlightCheckout] with no+ * [checkoutId] yet therefore reconciles to an uncertain "check your orders /+ * merchant website" state and is never replayed.+ */+@Serializable+data class InFlightCheckout(+    /** The idempotency key the write carries (or carried). Never reused for a new write. */+    val intent: String,+    val platformId: String,+    val shopDomain: String,+    val storeName: String = "",+    /** Cart lines as submitted, images stripped like every other persisted projection. */+    val lines: List<CartLine> = emptyList(),+    /** Null until the create returns; filled in before the embedded checkout opens. */+    val checkoutId: String? = null,+    val trackingToken: String = "",+    /** inflight | uncertain | pending */+    val status: String = STATUS_INFLIGHT,+    val createdAtMs: Long = 0,+) {+    companion object {+        const val STATUS_INFLIGHT = "inflight"+        const val STATUS_UNCERTAIN = "uncertain"+        const val STATUS_PENDING = "pending"+    }+}++/** Persists the single in-flight checkout intent as JSON in SharedPreferences (OrderStore pattern). */+object CheckoutIntentStore {+    private const val PREFS_NAME = "shop_checkout_intent"+    private const val KEY = "inflight_v1"+    private val json = Json { ignoreUnknownKeys = true }+    private val writeMutex = Mutex()++    suspend fun get(context: Context): InFlightCheckout? = withContext(Dispatchers.IO) {+        val raw = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)+            .getString(KEY, null) ?: return@withContext null+        runCatching { json.decodeFromString<InFlightCheckout>(raw) }.getOrNull()+    }++    suspend fun save(context: Context, record: InFlightCheckout) = writeMutex.withLock {+        withContext(Dispatchers.IO) {+            context.applicationContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)+                .edit { putString(KEY, json.encodeToString(record)) }+        }+    }++    suspend fun clear(context: Context, platformId: String, shopDomain: String) = writeMutex.withLock {+        withContext(Dispatchers.IO) {+            val prefs = context.applicationContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)+            val current = prefs.getString(KEY, null)?.let {+                runCatching { json.decodeFromString<InFlightCheckout>(it) }.getOrNull()+            }+            // Only clear our own store's record; another store may have taken over.+            if (current == null || (current.platformId == platformId && current.shopDomain == shopDomain)) {+                prefs.edit { remove(KEY) }+            }+        }+    }+}
shop/src/main/java/com/vayunmathur/shop/domain/NativeCheckoutCoordinator.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/domain/NativeCheckoutCoordinator.kt b/shop/src/main/java/com/vayunmathur/shop/domain/NativeCheckoutCoordinator.ktindex 4c8a2ec95b..249bd95eaf 100644--- a/shop/src/main/java/com/vayunmathur/shop/domain/NativeCheckoutCoordinator.kt+++ b/shop/src/main/java/com/vayunmathur/shop/domain/NativeCheckoutCoordinator.kt@@ -2,6 +2,7 @@ package com.vayunmathur.shop.domain  import com.vayunmathur.shop.data.CartLine import com.vayunmathur.shop.data.CheckoutInputs+import com.vayunmathur.shop.data.InFlightCheckout import com.vayunmathur.shop.data.CheckoutPhase import com.vayunmathur.shop.data.NativeCheckoutState import com.vayunmathur.shop.data.PlacedOrder@@ -66,6 +67,10 @@ internal class NativeCheckoutCoordinator(     private val now: () -> Long = System::currentTimeMillis,     private val newIntent: () -> String = { UUID.randomUUID().toString() },     private val changed: (List<NativeCheckoutState>) -> Unit = {},+    /** Awaited with the in-flight record BEFORE every write, and again once it resolves. */+    private val intentSink: suspend (InFlightCheckout) -> Unit = {},+    /** Called when a write is definitively rejected, so no in-flight record remains. */+    private val intentDone: suspend (platformId: String, shopDomain: String) -> Unit = { _, _ -> }, ) {     private val states = linkedMapOf<Pair<String, String>, NativeCheckoutState>()     private val locks = mutableMapOf<Pair<String, String>, Mutex>()@@ -207,19 +212,52 @@ internal class NativeCheckoutCoordinator(         previous: UcpCheckout?,         shop: String,         lines: List<CartLine>,-    ): UcpCheckout? {+    ): Pair<UcpCheckout, String>? {         // The server builds the exact dated projection and owns the idempotency         // ledger: a write is attempted exactly once and never auto-retried.         // The first write carries the whole profile (name, contact and address); only         // shipping-option choices wait until the merchant has offered them.         val sentInputs = if (previous == null) state.inputs.copy(options = emptyMap()) else state.inputs         val intent = newIntent()+        // Persist the intent BEFORE the write goes out: process death from here on+        // leaves a record the next launch reconciles instead of re-creating.+        intentSink(+            InFlightCheckout(+                intent = intent,+                platformId = key.first,+                shopDomain = key.second,+                storeName = lines.firstNotNullOfOrNull { it.storeName.ifBlank { null } }.orEmpty(),+                lines = lines.map { it.copy(imageUrl = "") },+                checkoutId = previous?.checkoutId,+                trackingToken = previous?.trackingToken.orEmpty(),+                status = InFlightCheckout.STATUS_INFLIGHT,+                createdAtMs = now(),+            ),+        )         val checkout = (if (previous == null) {             gateway.create(shop, lines.toList(), sentInputs, intent)         } else {             gateway.update(shop, previous.checkoutId, lines.toList(), sentInputs, intent)         }).getOrElse {             val unsupported = (it as? ShopBackendException)?.error as? UcpError.Unsupported+            if (unsupported != null) {+                // A definitive rejection created nothing: no in-flight record remains.+                intentDone(key.first, key.second)+            } else {+                intentSink(+                    InFlightCheckout(+                        intent = intent,+                        platformId = key.first,+                        shopDomain = key.second,+                        storeName = lines.firstNotNullOfOrNull { it.storeName.ifBlank { null } }.orEmpty(),+                        lines = lines.map { it.copy(imageUrl = "") },+                        checkoutId = previous?.checkoutId,+                        trackingToken = previous?.trackingToken.orEmpty(),+                        status = InFlightCheckout.STATUS_UNCERTAIN,+                        createdAtMs = now(),+                    ),+                )+            }             publish(                 key,                 state.copy(@@ -243,7 +281,7 @@ internal class NativeCheckoutCoordinator(             return null         }         createdAt.putIfAbsent(key, now())-        return checkout+        return checkout to intent     }      /** Publishes the post-write state and persists the pending-order projection. */@@ -254,6 +292,7 @@ internal class NativeCheckoutCoordinator(         checkout: UcpCheckout,         lines: List<CartLine>,         sink: PendingCheckoutSink,+        intent: String = "",     ) {         val sentInputs = if (previous == null) state.inputs.copy(options = emptyMap()) else state.inputs         val responseMatchesCart = cartMatches(checkout.submittedLines, lines)
shop/src/main/java/com/vayunmathur/shop/platform/ShopViewModel.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/platform/ShopViewModel.kt b/shop/src/main/java/com/vayunmathur/shop/platform/ShopViewModel.ktindex c56eca92b2..443cdc8ce6 100644--- a/shop/src/main/java/com/vayunmathur/shop/platform/ShopViewModel.kt+++ b/shop/src/main/java/com/vayunmathur/shop/platform/ShopViewModel.kt@@ -65,6 +65,9 @@ class ShopViewModel(         private set     var searchError by mutableStateOf<String?>(null)         private set+    /** Query the current [results]/[searchError] belong to; null until a search has run. */+    var searchedQuery by mutableStateOf<String?>(null)+        private set     var cart by mutableStateOf<List<CartLine>>(emptyList())         private set     /** Store whose one-tap checkout is being prepared, as (platformId, shopDomain). */@@ -151,6 +154,8 @@ class ShopViewModel(         scopeDomain = null         scopeName = null         results = emptyList()+        searchedQuery = null+        searchError = null         search()     } @@ -194,6 +199,8 @@ class ShopViewModel(         scopeName = name         query = scopedQuery         results = emptyList()+        searchedQuery = null+        searchError = null         navigate(Route.Search)         focusSearchRequest++         if (scopedQuery.isNotBlank()) search()@@ -230,6 +237,7 @@ class ShopViewModel(         val shop = scopeDomain         searching = true         searchError = null+        searchedQuery = q         results = emptyList()         viewModelScope.launch {             try {
shop/src/main/java/com/vayunmathur/shop/ui/SearchScreen.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/ui/SearchScreen.kt b/shop/src/main/java/com/vayunmathur/shop/ui/SearchScreen.ktindex 18cc55dd5d..43837d6887 100644--- a/shop/src/main/java/com/vayunmathur/shop/ui/SearchScreen.kt+++ b/shop/src/main/java/com/vayunmathur/shop/ui/SearchScreen.kt@@ -38,6 +38,8 @@ import com.vayunmathur.library.image.compose.AsyncImage import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Card import com.vayunmathur.library.ui.CircularProgressIndicator+import com.vayunmathur.library.ui.EmptyState+import com.vayunmathur.library.ui.ErrorState import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.IconClose import com.vayunmathur.library.ui.IconSearch@@ -46,7 +48,7 @@ import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.SearchBarInputField import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton-import com.vayunmathur.library.ui.rememberMessenger+import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.shop.R import com.vayunmathur.shop.data.UcpProduct import com.vayunmathur.shop.domain.MoneyFormat@@ -63,13 +65,6 @@ fun SearchScreen(     onProductClick: (variantId: String, platformId: String, shopDomain: String) -> Unit, ) {     val context = LocalContext.current-    val messenger = rememberMessenger()-    LaunchedEffect(viewModel.searchError) {-        viewModel.searchError?.let { error ->-            messenger.show(error)-            viewModel.dismissSearchError()-        }-    }     var showLinkPrompt by rememberSaveable { mutableStateOf(LinkDefaults.shouldPrompt(context)) }     SearchContent(         query = viewModel.query,@@ -78,6 +73,9 @@ fun SearchScreen(         results = viewModel.results,         onSearch = viewModel::search,         onProductClick = onProductClick,+        searchError = viewModel.searchError,+        searchedQuery = viewModel.searchedQuery,+        onRetry = viewModel::search,         scopeName = viewModel.scopeName,         onClearScope = viewModel::clearScope,         focusRequest = viewModel.focusSearchRequest,@@ -108,6 +106,9 @@ internal fun SearchContent(     onClearScope: () -> Unit = {},     focusRequest: Int = 0,     linkPrompt: LinkPrompt? = null,+    searchError: String? = null,+    searchedQuery: String? = null,+    onRetry: () -> Unit = onSearch, ) {     AppScaffold(         modifier = modifier,@@ -129,6 +130,9 @@ internal fun SearchContent(                 searching = searching,                 onProductClick = onProductClick,                 modifier = Modifier.weight(1f),+                searchError = searchError,+                searchedQuery = searchedQuery,+                onRetry = onRetry,             )         }     }@@ -193,6 +197,9 @@ private fun ProductResults(     searching: Boolean,     onProductClick: (variantId: String, platformId: String, shopDomain: String) -> Unit,     modifier: Modifier = Modifier,+    searchError: String? = null,+    searchedQuery: String? = null,+    onRetry: () -> Unit = {}, ) {     if (searching) {         Box(modifier.fillMaxSize(), contentAlignment = Alignment.Center) {@@ -200,20 +207,31 @@ private fun ProductResults(         }         return     }+    // Stored error strings are already friendly (ShopViewModel.toBackendMessage):+    // render verbatim as the message, never re-mapped through friendlyError.+    if (searchError != null) {+        ErrorState(+            title = stringResource(R.string.search_failed),+            modifier = modifier,+            message = searchError,+            retryLabel = stringResource(UiR.string.retry),+            onRetry = onRetry,+        )+        return+    }     if (results.isEmpty()) {-        Box(modifier.fillMaxSize(), contentAlignment = Alignment.Center) {-            Column(horizontalAlignment = Alignment.CenterHorizontally) {-                Text(-                    stringResource(R.string.no_products_found),-                    style = MaterialTheme.typography.titleMedium,-                )-                Spacer(Modifier.height(4.dp))-                Text(-                    stringResource(R.string.check_connection_retry),-                    style = MaterialTheme.typography.bodyMedium,-                    color = MaterialTheme.colorScheme.onSurfaceVariant,-                )-            }+        if (searchedQuery != null) {+            EmptyState(+                title = stringResource(R.string.no_products_found),+                modifier = modifier,+                message = stringResource(R.string.no_products_for_query, searchedQuery),+            )+        } else {+            EmptyState(+                title = stringResource(R.string.search_initial_title),+                modifier = modifier,+                message = stringResource(R.string.check_connection_retry),+            )         }         return     }
shop/src/main/res/values/strings.xml
diff --git a/shop/src/main/res/values/strings.xml b/shop/src/main/res/values/strings.xmlindex aec5b4e98d..1263aa366d 100644--- a/shop/src/main/res/values/strings.xml+++ b/shop/src/main/res/values/strings.xml@@ -5,6 +5,12 @@     <string name="search_products">Search products</string>     <string name="no_products_found">No products found</string>     <string name="check_connection_retry">Enter a search or try a different query</string>+    <!-- SearchScreen: initial state before any search has run -->+    <string name="search_initial_title">Find products</string>+    <!-- SearchScreen: no-results message echoing the submitted query. %1$s is the query -->+    <string name="no_products_for_query">No products for \"%1$s\". Try a different query.</string>+    <!-- SearchScreen: error state title; the stored error string is shown verbatim below it -->+    <string name="search_failed">Search failed</string>     <string name="cart">Cart</string>     <string name="cart_empty">Your cart is empty</string>     <string name="checkout">Checkout</string>
shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensCoverage2Test.kt
diff --git a/shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensCoverage2Test.kt b/shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensCoverage2Test.ktindex cc261374eb..8518f5e47b 100644--- a/shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensCoverage2Test.kt+++ b/shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensCoverage2Test.kt@@ -110,7 +110,7 @@ class ShopScreensCoverage2Test {         // flow) flips profileComplete; the gate root must reset to Search.         setVmField(vm, "profile", ShopProfile(firstName="Ada", lastName="L", email="[email protected]", phone="+14155550123"))         composeRule.waitForIdle()-        composeRule.onNodeWithText(str(R.string.no_products_found)).assertIsDisplayed()+        composeRule.onNodeWithText(str(R.string.search_initial_title)).assertIsDisplayed()         composeRule.onNodeWithText("Add your details to start shopping.").assertDoesNotExist()     } @@ -120,7 +120,7 @@ class ShopScreensCoverage2Test {         setVmField(vm, "profileLoaded", true)         composeRule.setContent { Navigation(vm) }         composeRule.waitForIdle()-        composeRule.onNodeWithText(str(R.string.no_products_found)).assertIsDisplayed()+        composeRule.onNodeWithText(str(R.string.search_initial_title)).assertIsDisplayed()         composeRule.onNodeWithText(str(R.string.cart)).assertIsDisplayed()         // Sibling tabs are routes: tapping a tab resets the stack to that tab.         composeRule.onNode(@@ -142,7 +142,7 @@ class ShopScreensCoverage2Test {             androidx.compose.ui.test.hasText(str(R.string.search)) and androidx.compose.ui.test.hasClickAction(),         ).performClick()         composeRule.waitForIdle()-        composeRule.onNodeWithText(str(R.string.no_products_found)).assertIsDisplayed()+        composeRule.onNodeWithText(str(R.string.search_initial_title)).assertIsDisplayed()     }      @Test fun navigation_ordersRequestStartsOnOrdersTab() {
shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensTest.kt
diff --git a/shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensTest.kt b/shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensTest.ktindex 7606e13774..65498ca87b 100644--- a/shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensTest.kt+++ b/shop/src/test/java/com/vayunmathur/shop/ui/ShopScreensTest.kt@@ -88,7 +88,8 @@ class ShopScreensTest {                 linkPrompt = LinkPrompt(onOpenSettings = { settings++ }, onDismiss = { dismissed++ }),             )         }-        composeRule.onNodeWithText(str(R.string.no_products_found)).assertIsDisplayed()+        composeRule.onNodeWithText(str(R.string.search_initial_title)).assertIsDisplayed()+        composeRule.onNodeWithText(str(R.string.no_products_found)).assertDoesNotExist()         composeRule.onNodeWithText("Open store links in Shop").assertIsDisplayed()         composeRule.onNodeWithText("Open settings").performClick()         composeRule.onNodeWithText("Not now").performClick()@@ -117,6 +118,38 @@ class ShopScreensTest {         assertEquals(1, cleared)     } +    @Test+    fun searchContent_noResultsShowsEchoedQueryDistinctFromInitial() {+        composeRule.setContent {+            SearchContent(+                query = "zzz", onQueryChange = {}, searching = false, results = emptyList(),+                onSearch = {}, onProductClick = { _, _, _ -> },+                searchedQuery = "zzz",+            )+        }+        composeRule.onNodeWithText(str(R.string.no_products_found)).assertIsDisplayed()+        composeRule.onNodeWithText("No products for \"zzz\". Try a different query.").assertIsDisplayed()+        composeRule.onNodeWithText(str(R.string.search_initial_title)).assertDoesNotExist()+    }++    @Test+    fun searchContent_errorShowsStoredStringVerbatimWithRetry() {+        var retries = 0+        composeRule.setContent {+            SearchContent(+                query = "shoe", onQueryChange = {}, searching = false, results = emptyList(),+                onSearch = {}, onProductClick = { _, _, _ -> },+                searchError = "Couldn't reach the store. Check your connection and try again.",+                searchedQuery = "shoe", onRetry = { retries++ },+            )+        }+        composeRule.onNodeWithText(str(R.string.search_failed)).assertIsDisplayed()+        composeRule.onNodeWithText("Couldn't reach the store. Check your connection and try again.").assertIsDisplayed()+        composeRule.onNodeWithText(str(R.string.no_products_found)).assertDoesNotExist()+        composeRule.onNodeWithText("Retry").performClick()+        assertEquals(1, retries)+    }+     @Test     fun searchContent_searchingShowsNoEmptyPrompt() {         composeRule.setContent {
uniflix/src/main/java/com/vayunmathur/uniflix/ui/SearchScreen.kt
diff --git a/uniflix/src/main/java/com/vayunmathur/uniflix/ui/SearchScreen.kt b/uniflix/src/main/java/com/vayunmathur/uniflix/ui/SearchScreen.ktindex eff8a53c0d..e1abc0d280 100644--- a/uniflix/src/main/java/com/vayunmathur/uniflix/ui/SearchScreen.kt+++ b/uniflix/src/main/java/com/vayunmathur/uniflix/ui/SearchScreen.kt@@ -11,12 +11,15 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier+import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.CircularProgressIndicator import com.vayunmathur.library.ui.DesktopMaxWidthContainer+import com.vayunmathur.library.ui.EmptyState import com.vayunmathur.library.ui.OutlinedTextField import com.vayunmathur.library.ui.Text+import com.vayunmathur.uniflix.R import com.vayunmathur.uniflix.domain.MediaItem import com.vayunmathur.uniflix.platform.SearchUiState @@ -45,6 +48,14 @@ fun SearchScreen(                     CircularProgressIndicator()                     return@Column                 }+                if (state.query.isNotBlank() && state.results.isEmpty()) {+                    EmptyState(+                        title = stringResource(R.string.no_results),+                        modifier = Modifier.weight(1f),+                        message = stringResource(R.string.no_results_for_query, state.query),+                    )+                    return@Column+                }                 LazyVerticalGrid(                     columns = GridCells.Adaptive(120.dp),                     modifier = Modifier.fillMaxSize(),
uniflix/src/main/res/values/strings.xml
diff --git a/uniflix/src/main/res/values/strings.xml b/uniflix/src/main/res/values/strings.xmlindex d6383c0393..95af66e68b 100644--- a/uniflix/src/main/res/values/strings.xml+++ b/uniflix/src/main/res/values/strings.xml@@ -27,6 +27,8 @@     <string name="empty_list_hint">Empty — add titles from a detail page.</string>     <string name="detail_failed">Detail failed to load.</string>     <string name="no_results">Nothing here yet.</string>+    <!-- SearchScreen: no-results message echoing the query. %1$s is the query -->+    <string name="no_results_for_query">No results for \"%1$s\". Try a different search.</string>     <string name="nothing_in_progress">Nothing in progress yet.</string>     <string name="no_addons_title">No stream addons installed</string>     <string name="no_addons_body">Add one to watch this title.</string>
uniflix/src/test/java/com/vayunmathur/uniflix/ui/DetailHomeSearchComposeTest.kt
diff --git a/uniflix/src/test/java/com/vayunmathur/uniflix/ui/DetailHomeSearchComposeTest.kt b/uniflix/src/test/java/com/vayunmathur/uniflix/ui/DetailHomeSearchComposeTest.ktindex c0667b4f42..9a9f8940a0 100644--- a/uniflix/src/test/java/com/vayunmathur/uniflix/ui/DetailHomeSearchComposeTest.kt+++ b/uniflix/src/test/java/com/vayunmathur/uniflix/ui/DetailHomeSearchComposeTest.kt@@ -87,6 +87,46 @@ class DetailHomeSearchComposeTest {         assertEquals(results[0], opened)     } +    @Test fun searchNoResultsShowsEchoedQuery() {+        composeRule.setContent {+            DynamicTheme {+                SearchScreen(+                    state = SearchUiState(query = "zzz", results = emptyList(), loading = false),+                    onQueryChange = {},+                    onBack = {},+                    onOpenDetail = {})+            }+        }+        composeRule.onNodeWithText("Nothing here yet.").assertIsDisplayed()+        composeRule.onNodeWithText("No results for \"zzz\". Try a different search.").assertIsDisplayed()+    }++    @Test fun searchLoadingDoesNotShowNoResults() {+        composeRule.setContent {+            DynamicTheme {+                SearchScreen(+                    state = SearchUiState(query = "zzz", results = emptyList(), loading = true),+                    onQueryChange = {},+                    onBack = {},+                    onOpenDetail = {})+            }+        }+        composeRule.onNodeWithText("Nothing here yet.").assertDoesNotExist()+    }++    @Test fun searchBlankQueryDoesNotShowNoResults() {+        composeRule.setContent {+            DynamicTheme {+                SearchScreen(+                    state = SearchUiState(query = "", results = emptyList(), loading = false),+                    onQueryChange = {},+                    onBack = {},+                    onOpenDetail = {})+            }+        }+        composeRule.onNodeWithText("Nothing here yet.").assertDoesNotExist()+    }+     @Test fun detailLoadingAndFailureStates() {         composeRule.setContent {             DynamicTheme {