fix(desktop): fix feed cold-boot race and remove NWC diagnostic println

Add LaunchedEffect that rescans cache when followedUsers populates after
startup, fixing empty feed when contact list arrives after initial scan.
Remove diagnostic println from NwcPaymentHandler.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
nrobi144
2026-05-23 14:02:48 +03:00
co-authored by Claude Opus 4.6
parent e690292bbd
commit 562cd3355b
2 changed files with 8 additions and 1 deletions
@@ -322,7 +322,6 @@ class NwcPaymentHandler(
subId = subId,
filters = listOf(filter),
onEvent = { event, _ ->
println("NWC rpc event received: kind=${event.kind} id=${event.id.take(8)} from=${event.pubKey.take(8)}")
if (event is LnZapPaymentResponseEvent && event.requestId() == requestId) {
@OptIn(kotlinx.coroutines.DelicateCoroutinesApi::class)
kotlinx.coroutines.GlobalScope.launch(kotlinx.coroutines.Dispatchers.IO) {
@@ -409,6 +409,14 @@ fun FeedScreen(
onDispose { viewModel.destroy() }
}
// Rescan cache when followedUsers populates (fixes cold-boot race where
// the initial scan runs before the contact list arrives from relays)
LaunchedEffect(viewModel, followedUsers) {
if (feedMode == FeedMode.FOLLOWING && followedUsers.isNotEmpty()) {
viewModel.feedState.refreshSuspended()
}
}
val feedState by viewModel.feedState.feedContent.collectAsState()
// Viewport-aware metadata loading: only fetch for visible notes + buffer