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

Addon Test: Only render the TestingModule component in development mode #29501

Merged
merged 5 commits into from
Nov 1, 2024

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Oct 31, 2024

Closes #

What I did

This PR fixes a situation like so:
image

So the testing module is only shown in local development, never when serving a Storybook in prod mode or when uploading to places like Chromatic

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!

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 78 MB 78 MB 0 B 2.38 0%
initSize 143 MB 143 MB 168 B 2.39 0%
diffSize 65.1 MB 65.1 MB 168 B 0.86 0%
buildSize 6.87 MB 6.87 MB 444 B 0.28 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B 1 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.9 MB 1.9 MB 444 B 0.28 0%
buildSbPreviewSize 271 kB 271 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.88 MB 3.88 MB 444 B 0.28 0%
buildPreviewSize 3 MB 3 MB 0 B 3 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 22.7s 7.4s -15s -361ms -1.49 🔰-206.7%
generateTime 19.8s 22s 2.1s -0.32 9.6%
initTime 14.7s 14.8s 62ms -0.73 0.4%
buildTime 10.4s 9.7s -639ms 0.59 -6.5%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 7.3s 7.1s -155ms 1.36 -2.2%
devManagerResponsive 4.6s 4.4s -270ms 1.1 -6.1%
devManagerHeaderVisible 847ms 698ms -149ms 0.46 -21.3%
devManagerIndexVisible 883ms 773ms -110ms 0.55 -14.2%
devStoryVisibleUncached 1.5s 1.5s -13ms 1.17 -0.9%
devStoryVisible 881ms 770ms -111ms 0.62 -14.4%
devAutodocsVisible 845ms 791ms -54ms 2.14 🔰-6.8%
devMDXVisible 734ms 673ms -61ms 1.18 -9.1%
buildManagerHeaderVisible 876ms 858ms -18ms 2.27 -2.1%
buildManagerIndexVisible 920ms 877ms -43ms 2.19 -4.9%
buildStoryVisible 874ms 857ms -17ms 2.26 -2%
buildAutodocsVisible 668ms 538ms -130ms 0.25 -24.2%
buildMDXVisible 740ms 528ms -212ms 0.21 -40.2%

Greptile Summary

Added conditional rendering of the TestingModule component in Storybook's sidebar to only show during development mode.

  • Added globalThis.CONFIG_TYPE === 'DEVELOPMENT' check in code/core/src/manager/components/sidebar/SidebarBottom.tsx to conditionally render TestingModule
  • Added id="storybook-testing-module" to Outline component in code/core/src/manager/components/sidebar/TestingModule.tsx for better accessibility
  • Testing module will no longer appear in production builds or when deployed to services like Chromatic

@yannbf yannbf added bug patch:yes Bugfix & documentation PR that need to be picked to main branch ci:normal addon: test labels Oct 31, 2024
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.

2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

nx-cloud bot commented Oct 31, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 54c8712. 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.

@yannbf yannbf merged commit 46e37f1 into next Nov 1, 2024
59 checks passed
@yannbf yannbf deleted the yann/hide-testing-module-on-prod branch November 1, 2024 13:55
shilman pushed a commit that referenced this pull request Nov 5, 2024
…n-prod

Addon Test: Only render the TestingModule component in development mode

(cherry picked from commit 46e37f1)
@github-actions github-actions bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Nov 5, 2024
@yannbf yannbf self-assigned this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: test bug ci:normal patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants