Use the current query when confirming search - #109
Open
Jim8y wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The change is small and targeted, and the PR adds regression tests that directly cover the reported stale-query confirmation behavior.
Pull request overview
This PR fixes a UI race in GlobalSearchPage where confirming search before the debounce completed could act on stale results, by invalidating any pending debounce and recomputing results synchronously before applying the existing “single result” navigation behavior.
Changes:
- Update
OnSearchButtonPressedto incrementsearchVersionand callUpdateResults()immediately, preventing delayed callbacks from applying stale results. - Add a focused regression test project (
tests/p2-11) that links the productionGlobalSearchPage.xaml.csand substitutes UI/persistence/network boundaries with lightweight stubs. - Add an xUnit theory covering confirm behavior when the query transitions from a prior single match to zero, one, or multiple matches.
File summaries
| File | Description |
|---|---|
| tests/p2-11/TestBoundary.cs | Adds minimal boundary stubs and a test-only partial for GlobalSearchPage to execute production logic without MAUI workloads. |
| tests/p2-11/SearchConfirmationTests.cs | Adds regression coverage ensuring confirmation uses current query/results even with a pending debounce. |
| tests/p2-11/SearchConfirmation.Tests.csproj | Introduces a dedicated net10.0 test project that links the production page source for behavioral coverage. |
| OneGateApp/Pages/GlobalSearchPage.xaml.cs | Fixes stale-confirm behavior by invalidating pending debounce and recomputing results before single-result navigation. |
| OneGateApp.slnx | Includes the new test project in the solution. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problem
Pressing Search before the debounce completed could open the previous query's sole result instead of searching the text currently in the field.
Change
Invalidate the pending debounce and synchronously recompute the results before applying the existing single-result navigation behavior.
This independent PR addresses audit P2-11 only, based on master
623603d.Validation
Screenshots and simulator-only fixtures remain outside the repository.