Repository navigation
feat(gallery): filter gallery and image map by media type - #9886
Merged
Merged
Conversation
Adds an Images only / Videos only / Both menu to the Gallery titlebar and Image Map header, sharing one per-project setting. Gallery, date-board and image-map endpoints accept an optional media_kind filter applied server-side; omitted keeps both kinds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joshistoast
reviewed
Oct 18, 2026
joshistoast
requested changes
Oct 18, 2026
joshistoast
left a comment
Collaborator
There was a problem hiding this comment.
issue with media kind filtering and page stamps
…at/gallery-media-type-filter # Conflicts: # invokeai/frontend/webv2/src/features/gallery/README.md # invokeai/frontend/webv2/src/features/gallery/core/settings.ts # invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx # invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetView.tsx # invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.test.ts
A ranked Preview reuses the selection's page only while its media kind matches the live filter, else starts from the Gallery page. Compare swap-back records the page Preview navigates, falling back to the selected page when the item is not loaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Merged Merge (cf9032d).
Review fix (b285d65). See the inline reply. Checks on the final head:
The local build byte gate reports editor initial raw assets at 3,262,847 bytes against a 3,259,135 limit. That is a local artifact: with no CI reference measurement, the limit falls back to the committed baseline, which |
joshistoast
approved these changes
Oct 18, 2026
lstein
enabled auto-merge (squash)
October 18, 2026 18:28
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
The Gallery and Image Map always showed images and videos together. This adds a media-type filter, Both (default), Images only and Videos only, as a menu in two places that share one setting:
The setting is saved per project with the other Gallery settings, such as sort order.
Backend: an optional
media_kindquery parameter (image|video) on these endpoints:/api/v1/gallery/items/,/items/location,/items/names,/item_names/api/v1/virtual_boards/by_date/{date}/item_names/points,/cluster_labels,/status,/searchand/search_by_imageGallery listings use sparse pages with authoritative totals and absolute positions, so the filter is applied in SQL. Totals, names, pages and location ranks all cover only the requested kind. On the image map,
media_kindoverridesinclude_videos. Cluster cache keys andvisible_hashare computed over the served kinds.Other behavior:
Related Issues / Discussions
None.
QA Instructions
Manual (
pnpm dev:mockininvokeai/frontend/webv2, or against a real backend with images and videos on the same board):Automated:
pnpm check:releaseininvokeai/frontend/webv2passes. That covers lint, all unit and browser tests, architecture performance and build budgets (no baselines re-recorded), project-file journeys and accessibility.pnpm lint && pnpm testininvokeai/frontend/apipass after regeneratingopenapi.jsonandschema.ts.uv tool run ruff@0.11.2 checkandformat --checkpass.uv run --no-sync pytest -n 4: all pass except 3 tests intests/app/routers/test_app_info.py. Those fail on main too whenever a builtinvokeai/frontend/webv2/distis present, because routes added inside the test land after the UI catch-all. Withdistabsent, all 36 tests in that file pass.Screenshots of both menus in dark and light themes, and of the Gallery at 280px and 350px, were checked during development. I can attach them on request.
Review
Findings resolved before opening:
IconRadioMenufrom@platform/ui/Menu, fed by a shared Gallery options definition. This adds no modules or requests to the editor's initial graph.Remaining limitations:
Compatibility / Rollout
media_kindis optional on every endpoint. Omitting it reproduces the previous queries exactly, so webv1 and older clients are unaffected.openapi.jsonandschema.tswere regenerated. The diff is additive.mediaFiltervalue lives in the Gallery widget's persisted values. A missing or unknown value parses to Both.Checklist
What's Newcopy (if doing a release after this PR)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.