utsmannn / osm-android-compose

OpenStreetMap android for compose
https://utsmannn.github.io/osm-android-compose/
38 stars 11 forks source link

Error When Navigation Back #1

Open alek43 opened 1 year ago

alek43 commented 1 year ago

Haloo utsmann, i have try your lib, but i got some error, when i got back requested after load the maps the apps force closing.

alek43 commented 1 year ago

java.lang.IllegalStateException: Check failed. at androidx.compose.runtime.saveable.SaveableStateRegistryImpl.performSave(SaveableStateRegistry.kt:138) at androidx.compose.runtime.saveable.SaveableStateHolderImpl$RegistryHolder.saveTo(SaveableStateHolder.kt:125) at androidx.compose.runtime.saveable.SaveableStateHolderImpl$SaveableStateProvider$1$1$invoke$$inlined$onDispose$1.dispose(Effects.kt:484) at androidx.compose.runtime.DisposableEffectImpl.onForgotten(Effects.kt:85)

Doomsdayrs commented 10 months ago

The issue is with rememberOverlayManagerState.

DefaultOverlayManager is not savable into a bundle.

Use the following alternative.

 rememberSaveable(key = null, saver = Saver(
                save = {
                       null
                },
                restore = {
                    OverlayManagerState(null)
                }
            )) {
                OverlayManagerState(null)
            }

Or just do not use this library. It is not maintained, and is not recommended for any production code.