As long as the reason for a change is something related to UI, like a click of a button, an input change in a field, etc., in most cases, the render cycle is kicked off by Blazor.
However, if the reason is something more nested like a timer or a finished asynchronous call, you can use the method StateHasChanged
in a component to trigger a new render cycle.
As mentioned in the comment, there might be drawbacks when this method is called outside the UI thread. await InvokeAsync(StateHasChanged)
helps to mitigate the issue. Besides, it is async like nearly which is more Blazor "serverish".
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…