In Compose Multiplatform, is there any known issue...
# multiplatform
m
In Compose Multiplatform, is there any known issue or limitation when using type-safe navigation and passing a data class as a parameter between screens? • Is there any size limit or serialization issue when passing larger data classes?
b
I think there is for too large jsons and stuff i tried once but yes there is better not to do that
d
Why would there be a limit - isn't it just passing a reference(?) In the early Android days, there were size limits of what could be passed between Activities, because everything jumped between Activities as primitives - no references allowed. Android Nav libraries would have inherited that. But I can't imagine why that would need to live on in Compose Multiplatform.
b
@darkmoon_uk IDK about compose multiplatform but Jetpack compose had it with too much large lists and stuff but idk what they do internally but yes passing a reference then there should not be a limit
z
When using Compose Multiplatform's navigation library, it just uses the original Jetpack Compose navigation component for the Android parts. So anything that applied there still applies. The data you pass as an argument to destinations gets serialized to be stored as saved state on Android (to recover navigation across process death), so if you pass huge amounts of data in the navigation arguments, they can still exceed the transaction limits of the OS.
blob ty sign 2
💡 4
m
I ran into an issue with navigation in one of my KMP apps. Specifically, it was with the graph for the bottom navigation bar. On Android, I was passing
drawable
resource IDs for the icons and
string
resource IDs for the tab titles. Since they were just Ints, serialization wasn't a problem. But with KMP, I had to switch to using
DrawableRes
and
StringRes
types. and surprise, those aren't serializable. I had to work around that to get things working.