Mikolaj Leszczynski
02/10/2022, 10:57 AM1.1.0
Fixes
• Jetpack Compose collect functions now correctly subscribe only when the lifecycle owner is at least STARTED
• repeatOnSubscription
used to hang forever in unit tests - now it always executes in a unit test
As always, massive thank you to our community for the suggestions, discussions and contribution 🙇
If you’re using Compose, do check it out as it fixes an important issue with Compose extensions!
@Rak you might want to take a look at this one for unit test improvementsGuilherme Delgado
02/10/2022, 7:14 PMonCreate: ((state: STATE) -> Unit)?
) it’s called 2 times.
I’m using jetpack compose:
• ActivityA has ViewModelA and everything is ok.
• ActivityB has a NavHost with 3 composable (“screens”). When they’re first created I get this 2 time problem, but after that, when I change between them, the container is created only once as expected.
For now, this is the best hint I can give you, but I’ll look deeper.
Any clue?
Thanks for your time.Benoît
02/22/2022, 9:05 AMintent
function using runBlocking
? What's the point of using a CoroutineScope
when creating the ContainerHost
like so scope.container(...)
?Guilherme Delgado
02/23/2022, 12:57 PMfun <STATE : Parcelable, SIDE_EFFECT : Any> ViewModel.container(...)
Why forcing kotlinx.parcelize.Parcelize
when we could also use kotlinx.serialization.Serializable
? 🤔
According to the docs if we want to store something in disk, Serializable would be preferable, where Parcelize would be the choice for IPC situations. SaveStateHandle also supports Serializable
What do you think about adding an extension that receives as STATE: Serializable
?Benoît
02/25/2022, 8:56 AMcontainerHost.assert( initialState ) {
states({ dataFromCache }) // first state
refreshCache() // update cache
states({ updatedDataFromCache }). // updated state emitted AFTER cache update
}
For some reason the 1st option fails fails, but if I run the following it passes:
refreshCache()
containerHost.assert( initialState ) {
states({ dataFromCache }, { updatedDataFromCache })
}
However, the 2nd option doesn't guarantee that the second state was only emitted after the refreshCache()
function was called. It feels like there's no way to assert the timing at which new states are emitted using the states
function.
Any idea?Guilherme Delgado
03/14/2022, 11:43 AMContainerHostExtensions.kt
using state: Lifecycle.State = Lifecycle.State.STARTED
as a parameter? 🤔 This way if for some reason we need to change it, we could.Benoît
03/14/2022, 2:58 PMtest()
and liveTest()
From what I understand, liveTest()
creates a real container host whereas test()
creates a "fake" one.
The test()
function has an isolateFlow
boolean, if set to true
(default value) then it will only test 1 intent. If an intent is fired inside another intent, the 2nd intent won't run.
containerHost.testIntent {
change1()
change2()
}
containerHost.assert(initialState) {
states(
{
copy(...)
},
{
copy(...)
}
)
}
If I run it with test(isolateFlow = true)
or with liveTest()
I get the same error "expected states but never received"
But when I run it with test(isolateFlow = false)
then my test passes
Shouldn't be the opposite? Shouldn't liveTest()
behave like test(isolateFlow = false)
?Rak
03/15/2022, 11:24 AMSami Eljabali
03/16/2022, 4:17 AMunable to open file (in target "iosApp" in project "iosApp")
• When following sample project & adding to Podfile :
◦ pod 'sharedOrbitSwift', :path => '../shared'
◦ In running pod install
get:
▪︎ No podspec found for "sharedOrbitSwift" in "../shared"
• orbit-swift-gradle-plugin, What's it for? Is it necessary to run Orbit MVI in KMM? Readme doesn't say much.
• Here's my sample project.
I'm a big Orbit fan(placed you guys on various awesome-lists 😄).
I promise to write up adequate documentation covering KMM setup once we figure this out. (I'm counting on you guys sticking around.) (See my sample project Readme as reference)
Thanks!miqbaldc
03/18/2022, 3:42 AMintent
?
Our attempts in 🧵Rak
03/18/2022, 9:24 PMhttps://www.youtube.com/watch?v=q7y6NQ_ou0A▾
Hitesh Chopra
03/19/2022, 1:18 PMHitesh Chopra
03/19/2022, 2:29 PMExpected :
[LoadingSideEffects$NavigateToLandingPage@4bc90c14]
Actual :
[LoadingSideEffects$NavigateToLandingPage@46a28b7f]
My side effect -:
class NavigateToLandingPage(val id:String) : LoadingSideEffects()
However when I try the same on side effects with no parameters, then the tests are passing e.g
object NavigateToLandingPage : LoadingSideEffects()
The latter will pass, however the former will fail.
For assertion, I am using
viewModel.assert(initialState = initialState) {
postedSideEffects(
LoadingSideEffects.NavigateToLandingPage(scheduleId)
)
}
This fails.
If I use,
val result = viewmodel.testIntent {
fetchStatus(id)
}
assert(result.sideEffectObserver.values.first() is LoadingSideEffects.NavigateToLandingPage)
This passes
Is this (result.sideEffectObserver.values.first()) the right way to test? And does it mean that we cannot use the format.
viewModel.assert(initialState = initialState) { }
when our side effect accepts some values/parameters?Oleksii Malovanyi
03/21/2022, 2:51 PMonValueChange
triggers intent
and reduce
that creates a new state which is propagated into this TextField as a value
;
the problem: orbit seems to be too slow to reduce the text into new state object if the user taps quickly - text field shows funny text.
Has anyone faced with this problem? What is your solution? Currently we gave up idea to hold the TextField text in the state of container and keep it in the Composable’s remeberSaveableGuilherme Delgado
03/24/2022, 2:04 PMRak
03/28/2022, 2:38 PMGuilherme Delgado
04/08/2022, 7:30 PMGuilherme Delgado
04/19/2022, 1:37 PMGuilherme Delgado
04/19/2022, 1:37 PMappmattus
06/01/2022, 4:49 PMRavi
06/03/2022, 10:22 AMSideEffect
pattern from orbit-mvi
Guilherme Delgado
06/22/2022, 1:25 PMGuilherme Delgado
07/13/2022, 1:46 PMRavi
07/27/2022, 8:39 AMGuilherme Delgado
08/12/2022, 9:55 AMRavi
08/17/2022, 1:21 PM1.2.0-beta02
miqbaldc
08/28/2022, 11:26 PMmiqbaldc
09/01/2022, 3:44 AMasync {
builder inside intent {
?
Code in 🧵Mikolaj Leszczynski
09/25/2022, 6:40 AM4.4.0
has been released!
This release focuses on unit testing fixes and improvements.
https://github.com/orbit-mvi/orbit-mvi/releases/tag/4.4.0Guilherme Delgado
09/27/2022, 10:26 PMGuilherme Delgado
09/27/2022, 10:26 PMMikolaj Leszczynski
09/28/2022, 4:35 AMGuilherme Delgado
10/04/2022, 9:21 PM