QuickGrid does not call stop when disposed while init is pending

Open Beginner friendly
#70,072 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@surya3655 is already working on this.

Since Oct 30, 2026.

  • #70073 by @jsakamotoIGJP — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend, frontend

Research direction

Start with src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs, especially the initialization and disposal paths around the linked lines. Trace what happens when init is pending as DisposeAsync runs, then check how the existing tests cover disposal and JS interop. Done means stop is called after pending initialization completes if the grid was disposed, with the listeners removed.

Written by the indexing model from the issue text.

Description

area-blazor feature-blazor-quickgrid
Is there an existing issue for this?
  • I have searched the existing issues
Describe the bug

This is a small follow-up to #47173, and it may not matter in practice.

The fix for #47173 (#62840) checks _wasDisposed after the module import. There is no such check after init. If QuickGrid is disposed while the init call is pending, _jsEventDisposable is still null at that time, so DisposeAsync does not call stop. The click, mousedown, and keydown listeners that init added then stay on document.body.

https://github.com/dotnet/aspnetcore/blob/f8bf4a7477/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs#L314-L321

To be honest, I am not sure this happens in real apps. The window is only one JS interop round trip, so a user would rarely navigate away at exactly that moment. If you think it is not worth fixing, please feel free to close this.

Expected Behavior

When QuickGrid is disposed, stop is called, even if init was still pending.

Steps To Reproduce

The repro project is at https://github.com/jsakamotoIGJP/quickgrid-dispose-race-repro

It uses a Playwright script that delays the reply of init on purpose (the original init runs unchanged), because the real window is too short to hit by hand. With QuickGrid 10.0.14, leaving the page while the init reply is delayed leaves 3 listeners on document.body, and stop is not called.

Exceptions (if any)

None.

.NET Version

10.0.14 (QuickGrid package). The code is the same on main.

Anything else?

The fix is small. It checks _wasDisposed once more after init, and calls stop if the grid has been disposed. I will open a PR, just in case it is worth taking.

Dominant language
C#
Stars
38.5k
Forks
12.3k
Avg merge
2d 6h
Merged PRs (30d)
203

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/aspnetcore

All issues in dotnet/aspnetcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.