Vaibhav Jaiswal
11/27/2024, 8:36 AMinit {}
block of a component and inside doOnCreate {}
init {
println("In Init")
doOnCreate {
println("in doOnCreate")
}
}
matsem
11/27/2024, 9:34 AMinit {}
block is called before component lifecycle is created or started, so you have to be mindful of what you do in init.
For example if your component holds a ChildStack
, it would be unsafe to mutate the stack right during init {}
call because in order to perform navigation, the Component must be at least in created (or started? can’t really tell) state. Otherwise, nothing would happen.Arkadii Ivanov
11/27/2024, 11:02 AMVaibhav Jaiswal
11/27/2024, 11:03 AMArkadii Ivanov
11/27/2024, 11:04 AMVaibhav Jaiswal
11/27/2024, 11:06 AMdoOnCreate
, does that mean in tests i can change it, to not call apis when component is created?Arkadii Ivanov
11/27/2024, 11:07 AMVaibhav Jaiswal
11/27/2024, 12:12 PMArkadii Ivanov
11/27/2024, 12:22 PMVaibhav Jaiswal
11/29/2024, 8:18 AM