QuickGrid does not call stop when disposed while init is pending
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
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
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.
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
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/aspnetcore
-
Include host.wslc.internal in the HTTPS development certificatePossibly taken @afscrome claimed this 6 days ago. Openarea-commandlinetools
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dotnet/aspnetcore#70122 · 1 comment ·
Maintainers usually reply within 1 day
-
RedisOutputCacheStore force reconnect can release the current connection instead of the failed oneOpenarea-middleware
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/aspnetcore#70029 · 3 comments ·
Maintainers usually reply within 1 day
-
area-middleware
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dotnet/aspnetcore#69849 · 1 comment ·
Maintainers usually reply within 1 day
-
area-signalr
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
dotnet/aspnetcore#69842 · 1 comment ·
Maintainers usually reply within 1 day
-
area-minimal NativeAOT
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dotnet/aspnetcore#69758 · 1 comment ·
Maintainers usually reply within 1 day
All issues in dotnet/aspnetcore
Similar issues
-
enhancement needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/microsoft-ui-reactor#1460 ·
Maintainers usually reply within 1 day
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
dotnet/maui#39950 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CommunityToolkit/Datasync#600 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NimblePros/deviq-hugo#121 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
philterd/phileas-dotnet#188 ·