Skip to content

fix(search): clear SelectedTags when AvailableTags is rebuilt#684

Merged
astar-development-jb merged 1 commit into
mainfrom
bug/683-search-checkbox-clear-selected-tags
Jun 23, 2026
Merged

fix(search): clear SelectedTags when AvailableTags is rebuilt#684
astar-development-jb merged 1 commit into
mainfrom
bug/683-search-checkbox-clear-selected-tags

Conversation

@jaybarden1

Copy link
Copy Markdown
Contributor

Summary

When SetActiveAccount is called (account switch) or OnViewActivatedAsync rebuilds the tag list because new tags are available, all CheckBox controls in the ItemsControl are destroyed and recreated — starting with IsChecked = false. However, SelectedTags was 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 SelectedTags inside the same dispatcher.Post callback that clears/rebuilds AvailableTags, in both SetActiveAccount and OnViewActivatedAsync.

Type of change

  • Feature
  • Bug fix
  • Refactor
  • CI/CD
  • Documentation
  • Maintenance

Related issues / links

Closes #683

How was this tested?

  • Unit tests added/updated
  • Manual validation
  • Not applicable

Three new tests in GivenASyncedFileSearchViewModel:

  • when_account_changes_then_selected_tags_are_cleared
  • when_view_is_activated_again_with_more_tags_then_selected_tags_are_cleared
  • when_view_is_activated_again_with_more_tags_then_search_does_not_apply_stale_selected_tags

All three were written red-first, then made green by the fix.

Impacted areas

apps/desktop/AStar.Dev.OneDrive.Sync.ClientSearch/SyncedFileSearchViewModel.cs, appsettings.json (version bump 0.29.0 → 0.29.1)


TDD Checklist (required)

  • Builds locally
  • Tests pass (dotnet test)
  • No new analyzer warnings
  • Public API changes reviewed
  • Documentation updated (if applicable)
  • Not applicable

How to run tests locally

dotnet restore AStar.Dev.slnx
dotnet test --verbosity normal

Notes for reviewers

  • Root cause: CheckBox items are recreated (visual state reset) when AvailableTags is rebuilt, but SelectedTags was not cleared to match.
  • The dispatcher.Post grouping ensures both collections are cleared atomically on the UI thread.

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>
@jaybarden1 jaybarden1 requested a review from a team June 23, 2026 06:47
@astar-development-jb astar-development-jb enabled auto-merge (squash) June 23, 2026 06:48
@astar-development-jb astar-development-jb merged commit 771b91a into main Jun 23, 2026
5 of 6 checks passed
@astar-development-jb astar-development-jb deleted the bug/683-search-checkbox-clear-selected-tags branch June 23, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(search): clearing a tag checkbox does not remove it from search criteria after tag list rebuild

2 participants