janvladimirmostert
10/24/2020, 2:49 PMsuspend fun lookupListings(): List<QueryListings.SelectListingsResult> {
if i make use of runBlocking, i'm assuming it's physically blocking a thread until that suspend function completes, what is the better route to take here to get rid of the `runBlocking`s?
class HomePage : PageResponse(
title = "Page Title",
description = "Page Description",
) {
val listings = runBlocking {
lookupListings()
}
val somethingElse = runBlocking {
suspendLookupSomethingElse()
}
Edit: this is on the JVMwilliam
10/24/2020, 4:15 PMrunBlocking
. otherwise, you need some coroutine scope to execute the suspend function that isn't blocking. it depends how those values in HomePage
are being usedjanvladimirmostert
10/24/2020, 4:16 PMBox {
Grid {
listings.forEach { listing ->
ListingItem {
+(listing.listingTitle ?: "")
}
}
}
}
william
10/24/2020, 4:19 PMjanvladimirmostert
10/24/2020, 4:20 PMwilliam
10/24/2020, 4:26 PMjanvladimirmostert
10/24/2020, 4:26 PMwilliam
10/24/2020, 4:28 PMjanvladimirmostert
10/24/2020, 4:30 PMwilliam
10/25/2020, 2:22 PM