Skip to content

Stop QuickGrid listeners when disposed during init - #70073

Open
jsakamotoIGJP wants to merge 1 commit into
dotnet:mainfrom
jsakamotoIGJP:quickgrid-dispose-during-init
Open

jsakamotoIGJP wants to merge 1 commit into
dotnet:mainfrom
jsakamotoIGJP:quickgrid-dispose-during-init

Conversation

@jsakamotoIGJP

Copy link
Copy Markdown
Contributor

Stop QuickGrid listeners when disposed during init

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Call stop when QuickGrid is disposed while init is pending

Description

A small fix, in case it is worth taking. #62840 added a _wasDisposed check after the module import. This PR adds the same check after init. If the grid has been disposed by then, OnAfterRenderAsync calls stop and disposes the handle, because DisposeAsync could not do it.

The new test StopsEventListenersWhenDisposedDuringInit disposes the grid while init is pending. It fails without the fix.

If the issue is closed as not worth fixing, I will close this PR too.

Fixes #70072

Copilot AI balanced review requested due to automatic review settings October 28, 2026 07:34
@jsakamotoIGJP
jsakamotoIGJP requested a review from a team as a code owner October 28, 2026 07:34
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Oct 28, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 28, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @jsakamotoIGJP. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@PureWeen

PureWeen commented Nov 3, 2026

Copy link
Copy Markdown
Member

/review

if (_wasDisposed)
{
// If the component has been disposed while init was running, DisposeAsync could not remove the listeners it added
await _jsEventDisposable.InvokeVoidAsync("stop");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

During permanent Interactive Server teardown, an already-admitted init completion can resume after the runtime has been marked disconnected and the grid disposed. This stop call then throws JSDisconnectedException, which can produce unhandled-render/circuit diagnostics during an expected disconnect. Could this late cleanup tolerate JSDisconnectedException, as DisposeAsync already does?

Human-directed and GitHub Copilot-generated.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service Bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Nov 10, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — d5e564ce Deployed Oct 28, 2026 by dotnet-policy-service[bot] via pat_pool #1997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-reviewed-needs-changes area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QuickGrid does not call stop when disposed while init is pending

3 participants