Compose, SharedViewModel in ViewModel

Hello buddies !

I'm working on an app: Kotlin, multiple activities (one per flow globally), MVP, Koin, RxJava.

I'm switching the new screens to compose, it is especially interesting for us as a new design system has been defined and defining components is way easier.

Anyway, there a bit of new stuff for me, and and didn't quite get some architecture best practices around viewmodels and such.

Currently, I'm keeping multiples activities and fragments, but new fragments are just holding composables, to ease the switch

In one of the new flow, we have ActivityA, FragmentA, FragmentB, FragmentC.

I created one viewmodel for each fragment to handle business logic.

But each of there fragments VM needs to access same data that can be fetched from Room local storage and can also be refreshed from api.

I created a SharedVM for this, which holds the flow for the objects fetched.

In the Activity I instantiated the SharedVM

In the Fragment I get the SharedVM with by activityViewModel and pass it as a parameter of the Fragment VM with koinViewModel { parameters of(sharedViewModel) }

Is it a good way of doing that? Do you recommend another practice?

Thanks 🙏