Skip to content

feat(snapshots): Add snapshot group sidecar override#271

Merged
cameroncooke merged 2 commits into
mainfrom
cameroncooke/eme-1187-support-overriding-grouping-in-snapshotpreviews
Jun 16, 2026
Merged

feat(snapshots): Add snapshot group sidecar override#271
cameroncooke merged 2 commits into
mainfrom
cameroncooke/eme-1187-support-overriding-grouping-in-snapshotpreviews

Conversation

@cameroncooke

Copy link
Copy Markdown
Contributor

Snapshot previews can now override the top-level JSON sidecar group field with .snapshotGroup("...") or use .snapshotGroup(.module) to group by the preview container module. When no override is provided, .default is 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 SnapshotGroup model through the existing metadata preference/rendering/export path and adds coordinator and preference coverage for trimming, fallback behavior, module grouping, nested context.group, and filename stability.

Refs EME-1187

cameroncooke and others added 2 commits June 15, 2026 16:39
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.
@linear-code

linear-code Bot commented Jun 15, 2026

Copy link
Copy Markdown

EME-1187

@cameroncooke cameroncooke marked this pull request as ready for review June 15, 2026 23:52
@cameroncooke cameroncooke merged commit 74b9ab9 into main Jun 16, 2026
27 checks passed
@cameroncooke cameroncooke deleted the cameroncooke/eme-1187-support-overriding-grouping-in-snapshotpreviews branch June 16, 2026 00:09
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.

2 participants