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

Controls: Add disableSave parameter #28734

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Jul 29, 2024

Closes #28377

What I did

Added a disableSave parameter to parameters.controls to be able to disable the "save toolbar" when adjusting controls.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Run a Next.js sandbox for template
  2. Open Storybook in your browser
  3. Access a story and change controls: The save toolbar should appear
  4. Shutdown Storybook
  5. Go to .storybook/preview.ts and set parameters.controls.disableSave: true
  6. Open Storybook
  7. Access a story and change controls: The save toolbar should not appear.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 76.4 MB 76.4 MB 0 B -0.66 0%
initSize 198 MB 198 MB 45 B 2.82 0%
diffSize 122 MB 122 MB 45 B 3.65 0%
buildSize 7.6 MB 7.6 MB 31 B Infinity 0%
buildSbAddonsSize 1.63 MB 1.63 MB 31 B Infinity 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.3 MB 2.3 MB 0 B - 0%
buildSbPreviewSize 349 kB 349 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.47 MB 4.47 MB 31 B Infinity 0%
buildPreviewSize 3.12 MB 3.12 MB 0 B - 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 6.7s 25.1s 18.3s 1.64 🔺73.1%
generateTime 20.3s 21.7s 1.3s -0.17 6.3%
initTime 21s 22.2s 1.2s -0.21 5.4%
buildTime 14.2s 14.6s 452ms -0.2 3.1%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 11.9s 8.4s -3s -458ms -0.27 -40.7%
devManagerResponsive 7.4s 5.4s -2s -27ms -0.65 -37.2%
devManagerHeaderVisible 1s 792ms -255ms -0.58 -32.2%
devManagerIndexVisible 1s 826ms -248ms -0.52 -30%
devStoryVisibleUncached 1.6s 1.3s -240ms -0.12 -17.3%
devStoryVisible 1.1s 852ms -250ms -0.54 -29.3%
devAutodocsVisible 1s 780ms -243ms -0.14 -31.2%
devMDXVisible 875ms 710ms -165ms -0.48 -23.2%
buildManagerHeaderVisible 1s 727ms -283ms -0.76 -38.9%
buildManagerIndexVisible 1s 734ms -295ms -0.75 -40.2%
buildStoryVisible 1s 777ms -315ms -0.77 -40.5%
buildAutodocsVisible 939ms 659ms -280ms -0.88 -42.5%
buildMDXVisible 1s 673ms -343ms -0.49 -51%

Greptile Summary

Introduced a disableSave parameter to the Storybook Controls addon, allowing users to disable the "save toolbar" when adjusting controls.

  • Updated code/addons/controls/src/ControlsPanel.tsx to include disableSave in parameters.controls and conditionally render the SaveStory component.
  • Modified docs/essentials/controls.mdx to document the new disableSave parameter, providing clear usage instructions.

@valentinpalkovic valentinpalkovic force-pushed the valentin/disable-save-from-controls branch from 39938e1 to cc0f779 Compare July 29, 2024 08:14
@valentinpalkovic valentinpalkovic marked this pull request as ready for review July 29, 2024 08:16
Copy link

nx-cloud bot commented Jul 29, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 7452e1e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Controls: Add option to disable "save from controls"
2 participants