How can this be done using MVUX #18140
-
I'm working on an app that shows a board with information about a bunch of machines. I add a "Card" for each machine in the system with info about its current status. That's my current ViewModel: internal partial record MachineBoardViewModel(MachinesService MachinesService)
{
public IState<MachineCriteria> Criteria => State.Value(this, () => new MachineCriteria());
public IListFeed<MachinesListItem> Machines => Criteria.SelectAsync(MachinesService.GetMachinesListAsync).AsListFeed();
} Then the user can start a task that connects to each machine sequentially via gRPC, and if the machine has a visible card in the screen, it should update the info without removing and inserting a new card. This task runs until the user stops it. Is that possible using MVUX? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @mcNets, to validate I understood your inquiry: The Machines Your question is that you want to find a way, using MVUX, so that the new Machines data that will arrive from the gRPC Streaming Tasks is updated in place instead of removing and inserting the new cc: Adding @dr1rrb to the conversation, as he could add valuable info here. |
Beta Was this translation helpful? Give feedback.
First, if you want to update items in a list, they need to be stored in an IListState. You can create a ListState from a Feed.
Once your have your ListState, you can Update your items based on the changes you're fetching.
https://platform.uno/docs/articles/external/uno.extensions/doc/Learn/Mvux/ListStates.html#fromfeed
https://platform.uno/docs/articles/external/uno.extensions/doc/Learn/Mvux/ListStates.html#update