feat(snapshots): Add snapshot group sidecar override#271
Merged
cameroncooke merged 2 commits intoJun 16, 2026
Merged
Conversation
Introduce a `.snapshotGroup(...)` view modifier that lets authors override the top-level `group` field in the exported JSON sidecar. Accepts a custom string or a `SnapshotGroup` strategy: `.default` keeps the generated group, `.custom` uses a provided name, and `.module` groups by the preview container's module name. Previously the sidecar `group` was always derived from the preview name, file path, and module with no way to influence it. The override is plumbed from the preference key through the rendering strategies and resolved during export, with empty or whitespace-only custom values falling back to the generated group. Exported filenames and manifest output are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Exercise the new snapshotGroup modifier across the DemoModule card previews by grouping them under "Card Views" and overriding OSVersionView to the module group. Remove the unused snapshotDiffThreshold override from RideShareButton now that grouping covers the demo coverage.
NicoHinderling
approved these changes
Jun 16, 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.
Snapshot previews can now override the top-level JSON sidecar
groupfield with.snapshotGroup("...")or use.snapshotGroup(.module)to group by the preview container module. When no override is provided,.defaultis used, the custom value is empty, or module extraction is unavailable, exports keep the existing generated group fallback.The override is intentionally limited to sidecar metadata: exported PNG/JSON filenames and all-image-names manifest output are unchanged. The change threads the new shared
SnapshotGroupmodel through the existing metadata preference/rendering/export path and adds coordinator and preference coverage for trimming, fallback behavior, module grouping, nestedcontext.group, and filename stability.Refs EME-1187