Open jacobtabak opened 3 months ago
@jacobtabak although this is a valid issue and we'll try to think what could be improved here, please keep in mind that we [recommend](https://docs.mapbox.com/android/maps/api/11.6.0/mapbox-maps-android/com.mapbox.maps.extension.compose.style.sources.generated/remember-geo-json-source-state.html?query=inline%20fun%20rememberGeoJsonSourceState(key:%20String?%20=%20null,%20sourceId:%20String%20=%20remember%20{%20%20%20%20generateRandomSourceId(%22geojson%22)%20%20},%20crossinline%20init:%20GeoJsonSourceState.()%20-%3E%20Unit%20=%20{}):%20GeoJsonSourceState) using your own remember
when working with large amounts of data. Can you try this out?
Environment
Observed behavior and steps to reproduce
rememberGeoJsonSourceState
We are loading some pretty complex geometry (testing with 1175 features) and following the examples, I tried using
rememberGeoJsonSourceState
in compose. However, under the hood, this function usesrememberSaveable
which tries to persist all of those features to a bundle to save their state when the activity is paused. This of course causes a crash for our use case which was a bit tricky to debug because it was not immediately clear why the bundle was so large until we dug into the code.Would it be reasonable to suggest making separate functions for
rememberGeoJsonSourceState
andrememberGeoJsonSourceStateSaveable
? For our use case we just implemented a non-saveable version.Expected behavior
Don't crash when saving state
Notes / preliminary analysis
Additional links and references