saket
02/10/2023, 10:15 PMsaket
02/10/2023, 10:15 PMclass FooPresenter @Inject constructor(
val dependency: Bar
) {
@Composable
fun json(): String
}
kevin.cianfarini
02/10/2023, 10:15 PMkevin.cianfarini
02/10/2023, 10:16 PMViewModel
for compose likely hinges on the interaction of the hilt library, ViewModel
, and compose navigation. They're so closely intertwined that some use cases are nice to use with that. If you try to do anything out of the norm (see: assisted injection) you get nothing but painkevin.cianfarini
02/10/2023, 10:17 PMViewModel
, hilt, and compose navigation) all suck.Trevor Stone
02/10/2023, 10:18 PMkevin.cianfarini
02/10/2023, 10:20 PMkevin.cianfarini
02/10/2023, 10:20 PMremember
keys if things are available as instance variables and can be accessed anywhere in the class.kevin.cianfarini
02/10/2023, 10:21 PMthis
Trevor Stone
02/10/2023, 10:21 PMkevin.cianfarini
02/10/2023, 10:22 PMsaket
02/10/2023, 10:28 PMkevin.cianfarini
02/10/2023, 10:31 PMsaket
02/10/2023, 10:32 PMkevin.cianfarini
02/10/2023, 10:34 PMthis
.
we've opted for the former because it's a more easily enforced pattern.Trevor Stone
02/10/2023, 10:37 PMkevin.cianfarini
02/10/2023, 10:44 PMclass Presenter {
@Composable fun foo() {
var state by remember { mutableStateOf(1) }
}
}
could be conflated (stale?) between different instances of presenter. Eg. two separate instances of Presenter
would read from and mutate the same state variable. You would conceptually think that states would normally be isolated since they belong to different object instances, but the way compose tracks things keyed in the slot table doesn't care about OOP.
keying the state by this
fixes this.kevin.cianfarini
02/10/2023, 10:47 PMjw
02/10/2023, 10:47 PMjw
02/10/2023, 10:47 PMkey(instance)
Javier
02/11/2023, 6:31 PMsuspend main
creating a scope and I have tried to use runBlocking
too.
A MonotonicFrameClock is not available in this CoroutineContext. Callers should supply an appropriate MonotonicFrameClock using withContext.
Javier
02/11/2023, 9:34 PMMoleculeViewModel
sample.
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "....DataSource.getFlow()" because "this.datasource" is null
class PupperPicsViewModel(private val datasource: Datasource) : MoleculeViewModel<Event, Model>() {
@Composable
override fun models(events: Flow<Event>): Model {
val data by datasource.flow.collectAsState()
return PupperPicsPresenter(events, PupperPicsService())
}
}
Shubham Singh
02/12/2023, 3:50 AMYou cannot connect to db from the browser environment. It's not compose-web specific limitation. Sqldelight for kotlin js is meant to be used in nodejs server environment.
So I wanted to check in this group whether it is true? Or is there any way by which we could persist data in JS using SQLDelight?
Note: Because of some configuration issues, I am not using the latest version of SQLDelight, I'm using the stable version 1.5.4
jw
02/12/2023, 3:52 AMJavier
02/12/2023, 11:59 AMLaunchedEffect
we need to operate over flows in the "normal" way, with collect
or any chain.
LaunchedEffect(Unit) {
events.collect { event ->
when (event) {
...
}
}
}
Should be great if I could remove the box there as we do with states
LaunchedEffect(Unit) {
val event by events.collectAsEvent()
when (event) {
...
}
}
Shubham Singh
02/12/2023, 1:09 PMcom.squareup
with app.cash
, removed the project-level gradle plugin and changed the version to 2.0.0-alpha05 but when I'm trying to sync the dependencies, I'm getting a long list of errors (image attached below). Would it help if I sent this whole list of errors in something like a pastebin link?eygraber
02/13/2023, 1:40 AMColton Idle
02/13/2023, 5:18 PMZac Sweers
02/13/2023, 5:44 PMZac Sweers
02/13/2023, 5:44 PM