Vsevolod Ganin
03/17/2021, 10:07 PMsetContent
on Activity and then just nothing - nothing updates on screen, nothing bumps into my breakpoints except top-level composable. Don’t know where to look honestlyVsevolod Ganin
03/17/2021, 10:09 PMVsevolod Ganin
03/17/2021, 10:18 PMArkadii Ivanov
03/17/2021, 10:32 PMVsevolod Ganin
03/17/2021, 10:33 PMdata class AppState(
val screens: List<Screen>,
etc.
)
Arkadii Ivanov
03/17/2021, 10:34 PMVsevolod Ganin
03/17/2021, 10:40 PMStateFlow<AppState>
in val in activity which I save and restore additionally. And then I have my update in MainScope.launch { stateFlow.collect(::setContent) }
Vsevolod Ganin
03/17/2021, 10:41 PMsetContent
gets called every click/update, that’s for sureVsevolod Ganin
03/17/2021, 10:42 PMsetContent
callZach Klippenstein (he/him) [MOD]
03/17/2021, 10:49 PMsetContent
in your case? can you post the actual code by any chance? the devil’s usually in the detailsVsevolod Ganin
03/17/2021, 10:50 PMprivate fun setContent(appState: AppState) {
val frontScreen = appState.backstack.screens.frontScreen() ?: return
val frontScreenPosition = appState.backstack.screens.frontScreenPosition()
val drawerState = appState.backstack.drawerState
setContent {
ContentView(
screen = frontScreen,
positionInBackstack = frontScreenPosition,
drawerScreenState = drawerState,
dispatch = ::dispatch
)
}
}
Zach Klippenstein (he/him) [MOD]
03/17/2021, 10:54 PMVsevolod Ganin
03/17/2021, 10:59 PMsealed class Screen : Parcelable {
data class ... : Screen
data class ... : Screen
}
All of them are data class
’es and it breaks exactly when another screen should pop up. For screen transition I use my custom thingy (sorry, not trying to advertise it). Additionally it is wrapped with Scaffold
. I strongly suspect that it may be a bug in my screen transition code but no luck fixing it so farVsevolod Ganin
03/17/2021, 11:01 PMZach Klippenstein (he/him) [MOD]
03/17/2021, 11:02 PMArkadii Ivanov
03/17/2021, 11:06 PMState
, Flow.collectAsState
or similar things?Vsevolod Ganin
03/17/2021, 11:09 PMmutableStateOf
for internal composables states, yes. I’m not using Flow.collectAsState
, there is no single composable that has Flow
as input in my codeVsevolod Ganin
03/17/2021, 11:13 PMState
!) but that’s just because it’s based on old Crossfade
implementation. I tried to add proper `SideEffect`s and use mutableStateOf
but still the bug reproducesZach Klippenstein (he/him) [MOD]
03/17/2021, 11:15 PMZach Klippenstein (he/him) [MOD]
03/17/2021, 11:15 PMComposableSwitcherState
?Vsevolod Ganin
03/17/2021, 11:16 PMZach Klippenstein (he/him) [MOD]
03/17/2021, 11:16 PMSideEffect
seems a bit smellyZach Klippenstein (he/him) [MOD]
03/17/2021, 11:16 PMZach Klippenstein (he/him) [MOD]
03/17/2021, 11:18 PMMutableList
in your state object. That list is iterated over in the Box
, but because it’s not a snapshot list, that mapTo
probably isn’t going to trigger a recomposition in at least some casesZach Klippenstein (he/him) [MOD]
03/17/2021, 11:19 PMVsevolod Ganin
03/17/2021, 11:20 PMZach Klippenstein (he/him) [MOD]
03/17/2021, 11:20 PMBox
lambda, so i think it’s not doing what it’s intended to (i.e. recompose the list)Zach Klippenstein (he/him) [MOD]
03/17/2021, 11:21 PMmutableStateListOf()
Vsevolod Ganin
03/17/2021, 11:21 PMinvalidate
invalidates only this particular node, not the complete subtree of that node?Zach Klippenstein (he/him) [MOD]
03/17/2021, 11:21 PMZach Klippenstein (he/him) [MOD]
03/17/2021, 11:21 PMVsevolod Ganin
03/17/2021, 11:22 PMVsevolod Ganin
03/17/2021, 11:24 PMCrossfade
is now a bit different from that time, maybe I will learn a trick or two from its code again 😄Zach Klippenstein (he/him) [MOD]
03/17/2021, 11:25 PMZach Klippenstein (he/him) [MOD]
03/17/2021, 11:29 PMVsevolod Ganin
03/20/2021, 7:25 PMmutablesStateOf
, mutablesStateListOf
).