https://kotlinlang.org logo
#compose
Title
# compose
h

Halil Ozercan

01/07/2021, 2:57 PM
I'm experiencing an issue while using navigation-compose. I have a very simple setup.
HomePage
composable receives a
HomeViewModel
and a
HomeState
object (caller passes
state.value
) as its arguments.
HomePage
also hosts a NavHost which includes 2 different routes(
SettingsPage
,
ProfilePage
) When I pass a field from HomeState like
homeState.username
to one of the composables defined in NavHost, it does not work. State changes do not reflect on children pages of
HomePage
. However, carrying
homeViewModel
and
homeState
directly into
HomePage
composable, fixes this issue.
a

Adam Powell

01/07/2021, 3:16 PM
Can you post this code?
h

Halil Ozercan

01/07/2021, 4:35 PM
I can share the project with direct link to where this is happening but I can also try to build a minimal example which reproduces the said issue. I'm reluctant to share the original project because it might be difficult to navigate through.
a

Adam Powell

01/07/2021, 4:39 PM
Ok. I suspect something like a stale lambda capture, but I'd like to see if there's something about the navigation-compose API shape that might lead one to it.
h

Halil Ozercan

01/07/2021, 4:40 PM
What do you mean by stale lambda? It kinda reminded me of another bug that I experienced but felt like I might have been doing something wrong.
Should I file a bug for this?
i

Ian Lake

01/09/2021, 3:28 PM
Yes, definitely file an issue against Compose
👍 1
2 Views