[feature]: New ViewModel type
Fhenix96 opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
I am using the cbl package and I often need to fetch or watch data in the couchbaseLite.
Also I am using Isar to save the user settings and sessions.
Now I have the Problem that I want to fetch the userSettings and also want to watch and fetch data in the couchbaseLite when opening the View.
This is currently not possible because there is no combination of the StreamViewModel and the FutureViewModel.
My current solution is that I fetch the userSettings in a View (route) before I open the desired View and pass them over.
I would like to have the opportunity to call Multiple Futures and Multiple Streams in a single ViewModel on initialise.
Describe the solution you would like
A new ViewModel that is a combination of the MultipleFutureViewModel and MultipleStreamViewModel.
When I open the View with this new type of ViewModel all Streams should be initialised and all Futures should be called and awaited.
There should be a streamsMap and a futuresMap just like as it is now.
The only difference is that "initialise" function calls all futures and initialises all streams.
I suggest the name "MultiDataSourceViewModel" but it is already used as a class name.
Additional Context
No response
Interesting idea, I think the better thing to do would be to allow you to use multiple ViewModels together.
We've attempted that before but it became very messy in the implementation and the use case was so small.
I would run the Future code manually in the ViewModel and use the StreamViewModel to listen to the data changes.