Repository navigation
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Cancel the pending suggestion request and close the popup when the control unloads, and do not reopen the popup from a request that was superseded or cancelled while awaiting SuggestionRequested. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…-unload-popup Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change preventing pending suggestion requests from reopening the popup after unload.
No open issues 🎉
What changed in this PR
Prevents pending suggestion requests from reopening a RichSuggestBox popup after the control unloads, without changing the public API.
Changes:
- Cancels the current query and closes the suggestion popup on unload.
- Checks cancellation before showing suggestions after an asynchronous request completes.
- Adds regression tests for unloading with a pending request while the popup is either open or closed.
| File | Description |
|---|---|
| components/RichSuggestBox/tests/Test_RichSuggestBox.cs | Adds two deferred-request regression cases covering popup state after unload and request completion. |
| components/RichSuggestBox/src/RichSuggestBox.Suggestion.cs | Prevents cancelled requests from reopening the popup. |
| components/RichSuggestBox/src/RichSuggestBox.cs | Registers unload handling to cancel the current query and close the popup. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
21d2800c52f1636fd73b9b82376e50804434ec7d↑ After-fix native suite completed with 384 total, 381 passed and 3 skipped.
↑ The merge of main brought in only
.github/workflows/build.yml. The product and test diff is identical to the native-tested commits.↑ The Copilot review of the current head found no issues. It is a COMMENTED review, not a human approval.
↓ The current-head CI run 45710245897 is awaiting maintainer approval and has run no jobs. Native, UWP and Uno results for this head are therefore missing.
↓ UWP ran no component tests on the earlier heads.
↓ The agent approved both gated fork CI runs with the account's admin rights. No maintainer approved them.
↑ The assertion right after unload passed, so WinUI already closes the popup when it unloads.
↓ The reported app runs were not traced to a request pending at unload.
Fixes
No linked issue. A native-only WinUI app sometimes left an unloaded RichSuggestBox's suggestion popup open with its full list. A fresh box's popup then appeared alongside it. The app used no third-party wrapper.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
RequestSuggestionsAsyncawaitsSuggestionRequested.InvokeAsync(...), then callsShowSuggestionsPopup(true). It never checks whether the request is still current or whether the control is still loaded. The control also has noUnloadedhandling, so a request pending at unload is never cancelled. When its deferral completes, the continuation reopens the popup on the unloaded control.This also covers a deferral that completes just before unload. Its continuation is already queued on the dispatcher and runs after unload.
What is the new behavior?
Unloaded, the control cancels the pending query's existingCancellationTokenSourceand closes the popup through the existingShowSuggestionsPopup(false)path.No public API changes. No delays were added.
The new
Test_RichSuggestBox_UnloadClosesSuggestionPopuptest types@through the document selection. ItsSuggestionRequestedhandler takes a deferral, so the request stays pending until the test completes it after unload. This ordering is deterministic, with no sleeps or retries. The test has two rows:@, then typesAto leave a second request pending.Both rows assert that the popup is closed after unload and still closed after the deferral completes.
PR Checklist
Please check if your PR fulfills the following requirements:
Other information
The standard Windows App SDK component suite ran in the existing, unchanged
CIworkflow. Both runs restoredMicrosoft.WindowsAppSDK.WinUI1.8.260204000.3158c9e1f1e217c4c4617ab660bfa08e6a8ebe70compiled. Both rows failed atSuggestion popup reopened after a pending request completed on an unloaded control. The assertion right after unload passed, so WinUI closes the popup on unload and the pending continuation reopens it. The full suite finished with 384 total, 379 passed, 2 failed and 3 skipped. Native baseline job.d7dfbc92021c1feed1d35719ba186d61f56d444d, both unchanged rows passed. The full suite finished with 384 total, 381 passed and 3 skipped. After-fix native job.Both UWP jobs built and passed the 39 source-generator tests (baseline, after fix). Both reported
No test is available in entrypoint\CommunityToolkit.Tests.Uwp.exefor component tests, so they show only that the code builds.Eight Uno-target jobs failed in
Run Uno Check to Install Dependencies, before compiling. That is the shared CI issue fixed by #893.Main, including #893 (
af067edcc29e92cb28376aaf54f4cd99c8ac523f), was merged into this branch without rewriting history. The merge brought in only.github/workflows/build.yml. The current-head run 45710245897 on21d2800c52f1636fd73b9b82376e50804434ec7dis awaiting maintainer approval for fork workflows and has run no jobs. The Uno jobs' behavior after #893 is therefore unverified on this PR. The native before/after results above belong to the commits named there, not to the current head.The Copilot review of
21d2800c52f1636fd73b9b82376e50804434ec7dcompleted with no open issues or inline comments. Its state isCOMMENTED, not a human approval.Both earlier fork workflow runs (45497230771 and 45499992386) were waiting for approval. The agent approved them with the account's admin rights, not a maintainer. The agent has not approved the current-head run.
This PR remains draft. No merge or auto-merge is requested. No CI workflow was changed. No local GUI, Appx or OS operations were used.