feat(preprod): Fix snapshot tag filtering and make tags interactive#116330
Merged
Conversation
Tag filtering now narrows individual images within groups instead of including/excluding entire groups, matching the behavior of search filtering. Tag counts update dynamically with cross-key awareness, status pill counts respect active tag filters, the tag section scrolls when it has many entries, and tags in the main content area are clickable to toggle filters.
Contributor
📊 Type Coverage Diff
🔍 3 new type safety issues introducedNon-null assertions (
This is informational only and does not block the PR. |
Fix tag filtering to use single-select per key with AND semantics across keys. Remove cross-filter skip so same-key counts reflect the full filter state. Thread activeTagFilters to card badges so active tags are visually highlighted on snapshot cards. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tag filters are single-select per key since each image can only have one value per tag key. Replace Record<string, Set<string>> with Record<string, string> to match the actual data model, simplifying the toggle handler, filter checks, and prop types across 7 files. Extract imageMatchesTagFilters and narrowItemByTags into a dedicated tagFiltering module with unit tests covering matching, partial matches, null tags, and pair-based items. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract shared TagChip to its own module and reuse it in both the sidebar tag filter section and the collapsible badge row. Remove redundant ActiveTagChip (replaced by TagChip with isActive). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduce TagFilterContext to provide activeTagFilters and onToggleTagFilter to leaf components directly. This removes ~70 lines of pass-through prop declarations across 6 intermediate layers (SnapshotMainContent, SnapshotListView, GroupContainer, PairCard, ImageCard, CardHeader) that never used the values themselves. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Compute availableTags from all sidebar items rather than the already- filtered set so tag chips remain visible when search or status filters narrow results. Tags with zero matches render as disabled chips instead of disappearing. Also hoists the passesFilters check out of the inner tag loop since it depends only on the image, not the individual tag. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
The search filter check in the availableTags memo was running once per image, but it only depends on item-level data. Move it above the image loop so it runs once per item. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…erSection useTagFilters() returns nullable, so destructuring with ! would crash with no useful message if rendered outside TagFilterProvider. Early return null instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ec526d5. Configure here.
availableTags was checking search at the group level via narrowItemBySearch, then counting tags from all images in the group. searchFilteredItems narrows groups to only individually matching images. This mismatch inflated tag chip counts when a search partially matched a group. Check search per-image using the pre-computed memberSearchKeys index instead. This also replaces the narrowItemBySearch call with a direct string.includes, which avoids allocating narrowed item copies. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
NicoHinderling
approved these changes
May 28, 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.

Tag filtering previously operated at the group level — if any image in a group matched a tag, the entire group (with all its images) was included. This meant filtering by a tag showed unrelated images, counts didn't update, and the sidebar table of contents was inconsistent with search behavior.
Tag filtering now narrows individual images within groups (matching how search already works), counts update dynamically, and tags in the main content area are clickable.
Image-level narrowing
narrowItemByTagsreplaces the old booleanitemMatchesTagFiltersand returns a newSidebarItemwith only matching images/pairs kept, mirroring the existingnarrowItemBySearchpattern. A newtagFilteredItemsmemo sits betweensearchFilteredItemsandfilteredItemsin the derivation chain, so status pill counts and sidebar group counts all reflect the narrowed set.Cross-key dynamic tag counts
availableTagsnow recomputes with cross-key awareness: selectingtheme=darkupdates counts for other tag keys (likearea) to reflect only images matchingtheme=dark, while thethemekey's own values retain full counts so users can toggle between them. Tags that reach count 0 render as disabled chips.Sidebar overflow and clickable tags
The tag filter section's content area is capped at 200px with scroll to prevent it from pushing the table of contents off-screen. Tags rendered on image cards in the main content area (
CollapsibleBadgeRow) now accept anonTagClickcallback, rendering as styled buttons with hover state that toggle the corresponding sidebar filter.