Fix sharedKoinViewModel fails with type-safe navigation routes#2293
Fix sharedKoinViewModel fails with type-safe navigation routes#2293arnaudgiuliani merged 3 commits intoInsertKoinIO:4.2.0from
Conversation
|
I don't see why it bring stronger verification here, as the compiler should already help here. |
|
@arnaudgiuliani |
|
Do you have a test case to reproduce, something we can add into examples project, the android compose app? |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where sharedKoinViewModel fails when using type-safe navigation routes. The fix adds conditional handling to support both string-based and type-safe (object-based) navigation routes.
- Adds type checking to handle both String and non-String route types
- Ensures
getBackStackEntryis called appropriately for both route formats
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...ompose-viewmodel-navigation/src/commonMain/kotlin/org/koin/compose/viewmodel/NavViewModel.kt
Show resolved
Hide resolved
|
@arnaudgiuliani Added:
You can test it by running the app and tapping "(>)Type Safe Navigation Example" or "(>)String Navigation Example". Both examples demonstrate that screens share the same ViewModel |
|
Thanks for your work @nazaburo 🙏 |
Fix sharedKoinViewModel fails with type-safe navigation routes #2292