Skip to content

Support triggering rendering from OnAfterRenderAsync. Fixes #8435 #8960

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

Merged

Conversation

SteveSandersonMS
Copy link
Member

Thanks to @DeanRoddey for reporting this.

This PR fixes the case where you invoke StateHasChanged synchronously inside OnAfterRenderAsync. 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.

@SteveSandersonMS SteveSandersonMS added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-blazor Includes: Blazor, Razor Components labels Apr 1, 2019
@SteveSandersonMS SteveSandersonMS added this to the 3.0.0-preview4 milestone Apr 1, 2019
Copy link
Member

@javiercn javiercn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SteveSandersonMS SteveSandersonMS merged commit 7f4dd27 into master Apr 1, 2019
@SteveSandersonMS SteveSandersonMS deleted the stevesa/allow-rendering-from-onafterrenderasync branch April 1, 2019 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants