[Question] What is the correct way to call StateHasChanged when a collection changes (Blazor)? #3230
Unanswered
geometrikal
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using ReactiveUI.Blazor to implement MVVM in a Blazor WASM application.
View models are made available using the built-in DI. They inherit from
ReactiveObjectand I'm usingSourceListfor the observable collection, e.g.public SourceList<int> MyListOfNumbers {get; set;} = new()The views inherit from
ReactiveInjectableComponentBase<TViewModel>.If any properties are changed in the view model the component will automatically update. However if the
SourceListchanges, it does not. What is the correct way to watch forSourceListchanges and update the component? Currently I do the following insideOnInitialisedin the view:Is this correct?
(Can someone alse explain what is being done inside
OnAfterRenderinReactiveInjectableComponentBaseto hook up the properties toStateHasChanged)Beta Was this translation helpful? Give feedback.
All reactions