Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add paramKey: "chromatic" to allow disabling the VTA panel through story parameters #334

Merged
merged 3 commits into from
Aug 29, 2024

Conversation

mellm0
Copy link
Contributor

@mellm0 mellm0 commented Aug 7, 2024

Configures the addon's paramKey, so that disabling this parameter will disable the Visual Tests panel in Storybook for a specific story:

const MyStory = {
  parameters: {
    chromatic: {
      disable: true
    }
  }
}

Similarly, this can be set on meta instead to disable the VTA for all stories in the file.

The key is set to chromatic because this will cause Chromatic to skip the story when snapshotting. If you want to disable snapshotting without disabling the addon panel, you can use the disableSnapshot: true parameter instead.

@ghengeveld
Copy link
Member

@mellm0 Thanks for the contribution! What is your intention here? The paramKey would allow you to disable/hide the addon panel (tab), but it wouldn't completely disable visual testing for a particular story. In fact if you'd disable the panel, the story would still be tested/snapshotted regardless. That's probably not what you expect?

If you'd expect snapshotting to be disabled for the story and have the panel disabled, then we could set paramKey to "chromatic". Normally you'd disable snapshotting for a story using the chromatic.disableSnapshot parameter, but we actually also support chromatic.disable for historical reasons.

@tmeasday WDYT?

@ghengeveld ghengeveld changed the title Add param key Add paramKey to allow disabling the VTA panel through story parameters Aug 21, 2024
@mellm0
Copy link
Contributor Author

mellm0 commented Aug 29, 2024

My intention is simply to have the ability to hide the panel on certain stories, though its true this does coincide with also disabling chromatic snapshots for it.

My specific scenario required me to create a story rather than a docs page since I wanted the themes, accessibility and other addons be available for a Sandbox we are creating for our design system.

I only chose the ADDON_ID as some other addons do the same, and I wanted it to be consistent. But I can change the name to chromatic, and that way it can hide at the same time.

Might be a breaking change for users who expect to still see the panel, but are using disable instead of disableSnapshot to disable Chromatic snapshots. I wanted to avoid that too.

@ghengeveld
Copy link
Member

ghengeveld commented Aug 29, 2024

@mellm0 Sounds good. I think this is a legitimate use case so if you change PARAM_KEY to "chromatic", I'm happy to merge this.

We're looking at updating some backend code to make disable behave identically to disableSnapshot as there's currently a slight difference, but as an end user it's not noticeable so it doesn't matter.

@mellm0
Copy link
Contributor Author

mellm0 commented Aug 29, 2024

Updated 👍🏼

@ghengeveld ghengeveld changed the title Add paramKey to allow disabling the VTA panel through story parameters Add paramKey: "chromatic" to allow disabling the VTA panel through story parameters Aug 29, 2024
@ghengeveld ghengeveld self-requested a review August 29, 2024 12:10
@ghengeveld ghengeveld added release Auto: Create a `latest` release when merged feature Classification: New feature minor Auto: Increment the minor version when merged and removed feature Classification: New feature labels Aug 29, 2024
@ghengeveld
Copy link
Member

Thanks a lot @mellm0! I've updated the PR title and description to more clearly explain the update and how to use the parameter.

@ghengeveld ghengeveld merged commit 97ad164 into chromaui:main Aug 29, 2024
2 of 6 checks passed
@ghengeveld
Copy link
Member

Shipped in v1.8.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Auto: Increment the minor version when merged release Auto: Create a `latest` release when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants