-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PushUpdates causes all viewmodels of same client instance to push the changes #325
Comments
Indeed, PushUpdates by design will send updates from all active view models. In your case, you may need to implement synchronization between the multiple PushUpdates, or in the long-running function, to keep the changes in a local object until you're ready to set everything to the view model properties in one go. |
Thank you for the fast respone. dotNetify/DotNetifyLib.Core/VMController/VMController.cs Lines 394 to 397 in 4d98aac
dotNetify/DotNetifyLib.Core/VMController/VMController.cs Lines 310 to 313 in 4d98aac
For the active PushUpdates the corresponding code seems to be this one: dotNetify/DotNetifyLib.Core/VMController/VMController.cs Lines 676 to 680 in 4d98aac
Is there an easy way for me to override the VMController? Maybe an option to disable this behaviour and force it via a parameter in "PushUpdates" would be useful? |
This was designed this way to ensure multiple view models stay in sync with each other. For example, in a list-detail pattern, a list selection change must also trigger the detail update. A possible solution for your use case is to add a new type of view model that the general PushUpdates would simply ignore and let it initiate its own updates in isolation, but that would require changes in a few areas of the framework, but truthfully I would rather this be solved in the application level per my previous suggestions. |
I am using the useConnect hook to connect to different viewmodels from the same client.
It seems that when I do "PushUpdates" in one of the viewmodels, the changes of both viewmodels are transmitted to the client.
I dont't think this is the correct behaviour or am I doing something wrong here?
For me this results in some problems:
In one viewmodel I am using a timer to poll some data and update the view via "PushUpdates".
In the other viewmodel I am calling a long operating function that fetches some data and assign it to multiple propertys of the viewmodel.
Now if the "PushUpdates" of the first viewmodel is called during that function call of the second viewmodel, half of the data of the second viewmodel is pushed to the client before all data is fetched. Of course the missing data is pushed after the function is finished but in my view I expect to get all data at once.
Is this the intended behaviour of "PushUpdates" or might this be a bug?
The text was updated successfully, but these errors were encountered: