fix(search): clear SelectedTags when AvailableTags is rebuilt#684
Merged
astar-development-jb merged 1 commit intoJun 23, 2026
Merged
Conversation
When SetActiveAccount was called or OnViewActivatedAsync rebuilt the tag list due to new tags, all CheckBox controls were destroyed and recreated (starting unchecked), but SelectedTags was never cleared. Stale tags survived the rebuild and silently filtered subsequent searches even though no checkbox appeared checked. Fixes #683 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
astar-development-jb
approved these changes
Jun 23, 2026
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.
Summary
When
SetActiveAccountis called (account switch) orOnViewActivatedAsyncrebuilds the tag list because new tags are available, allCheckBoxcontrols in theItemsControlare destroyed and recreated — starting withIsChecked = false. However,SelectedTagswas never cleared in either path. Previously selected tags survived the rebuild invisibly and silently filtered subsequent searches even though no checkbox appeared checked.Fix: clear
SelectedTagsinside the samedispatcher.Postcallback that clears/rebuildsAvailableTags, in bothSetActiveAccountandOnViewActivatedAsync.Type of change
Related issues / links
Closes #683
How was this tested?
Three new tests in
GivenASyncedFileSearchViewModel:when_account_changes_then_selected_tags_are_clearedwhen_view_is_activated_again_with_more_tags_then_selected_tags_are_clearedwhen_view_is_activated_again_with_more_tags_then_search_does_not_apply_stale_selected_tagsAll three were written red-first, then made green by the fix.
Impacted areas
apps/desktop/AStar.Dev.OneDrive.Sync.Client—Search/SyncedFileSearchViewModel.cs,appsettings.json(version bump 0.29.0 → 0.29.1)TDD Checklist (required)
dotnet test)How to run tests locally
dotnet restore AStar.Dev.slnx dotnet test --verbosity normalNotes for reviewers
CheckBoxitems are recreated (visual state reset) whenAvailableTagsis rebuilt, butSelectedTagswas not cleared to match.dispatcher.Postgrouping ensures both collections are cleared atomically on the UI thread.