When calling a referenced component's functions, the UI isn't being updated.
Steps to reproduce the behavior:
@refI made a fiddle that can be used to view this issue https://blazorfiddle.com/s/zkmpjypw
Clicking 'Show from component scope' button works just fine but clicking 'Show using ref' doesn't make the alert show.
If running in the debugger, you'll see that the component's function is called and the variables change but the DOM element is unchanged.
DOM should reflect changes from @ref'd calls
Figured out that StateHasChanged must be called to get the DOM to register these changes, is there any way this could happen automatically?
It is intentional that we don't do this by default. If you call a method on a .NET object, Blazor isn't involved, that's entirely inside your code.
Even if we could intercept that, it's not obvious that we should trigger rerendering - we don't know if the method you called impacts the UI in any way.
Most helpful comment
It is intentional that we don't do this by default. If you call a method on a .NET object, Blazor isn't involved, that's entirely inside your code.
Even if we could intercept that, it's not obvious that we should trigger rerendering - we don't know if the method you called impacts the UI in any way.