Support triggering rendering from OnAfterRenderAsync. Fixes #8435 #8960
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks to @DeanRoddey for reporting this.
This PR fixes the case where you invoke
StateHasChanged
synchronously insideOnAfterRenderAsync
. Previously such render requests were ignored, because our post-batch cleanup logic was erasing the knowledge that another render had been requested.Normally this wouldn't have been massively urgent because it's quite an edge case, but pretty soon this will not be an edge case. This re-render-from-
OnAfterRenderAsync
technique is central to our plan for the idiomatic way to handle #8786. As such I'm keen to include this fix immediately.The real value of this PR is mostly its test cases. The actual implementation details of how the renderer was fixed are a minor detail that will probably change anyway with @javiercn's much bigger PR. But the test cases should remain relevant.