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

Manager: Fix size regression #29660

Merged
merged 1 commit into from
Nov 19, 2024
Merged

Manager: Fix size regression #29660

merged 1 commit into from
Nov 19, 2024

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Nov 19, 2024

Follow-up to #29557

See regression at #29657 (comment)

What I did

Fixed imports in manager that imports from manager-api. manager-api is globalized when correctly imported as @storybook/core/manager-api, but we had introduced a few relative imports, which meant that manager was now bundling in manager-api directly, causing its size to increase by 168 KB.

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-storybook/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.4 MB 78.4 MB 0 B 0.28 0%
initSize 144 MB 144 MB -201 kB -0.05 -0.1%
diffSize 65.3 MB 65.1 MB -201 kB -1.06 -0.3%
buildSize 7.03 MB 6.83 MB -201 kB -1.49 -2.9%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.06 MB 1.86 MB -201 kB -1.56 🔰-10.8%
buildSbPreviewSize 271 kB 271 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.04 MB 3.83 MB -201 kB -1.56 🔰-5.2%
buildPreviewSize 3 MB 3 MB 0 B 0.99 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 25.8s 21.9s -3s -885ms 0.73 -17.7%
generateTime 22.9s 22.1s -803ms 0.21 -3.6%
initTime 14.9s 16.3s 1.4s 0.96 8.6%
buildTime 8s 8s 19ms -0.9 0.2%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.8s 6.7s -169ms 1.8 -2.5%
devManagerResponsive 4s 4s -5ms 1.5 -0.1%
devManagerHeaderVisible 608ms 693ms 85ms 2 🔺12.3%
devManagerIndexVisible 702ms 775ms 73ms 1.71 🔺9.4%
devStoryVisibleUncached 1.1s 1.7s 594ms 4.53 🔺33.6%
devStoryVisible 647ms 741ms 94ms 1.55 🔺12.7%
devAutodocsVisible 502ms 555ms 53ms 1.04 9.5%
devMDXVisible 548ms 495ms -53ms 0 -10.7%
buildManagerHeaderVisible 611ms 671ms 60ms 1.68 🔺8.9%
buildManagerIndexVisible 628ms 689ms 61ms 1.6 🔺8.9%
buildStoryVisible 613ms 669ms 56ms 1.69 🔺8.4%
buildAutodocsVisible 601ms 569ms -32ms 1.45 🔰-5.6%
buildMDXVisible 493ms 585ms 92ms 2.83 🔺15.7%

Greptile Summary

Updated import paths in manager components to use globalized @storybook/core/manager-api, fixing a 168KB size regression caused by direct bundling of manager-api through relative imports.

  • Changed StoriesHash import in code/core/src/manager/components/sidebar/StatusContext.tsx to use @storybook/core/manager-api
  • Updated ManagerContext import in TestingModule.stories.tsx to use absolute path
  • Modified imports in TestingModule.tsx to use @storybook/core prefixes for components and manager-api
  • Updated State type import in defaultShortcuts.tsx to use globalized path

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no suggestions.

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

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

nx-cloud bot commented Nov 19, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit e8ba1c2. 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 2 targets

Sent with 💌 from NxCloud.

@storybook-pr-benchmarking
Copy link

Package Benchmarks

Commit: e8ba1c2, ran on 19 November 2024 at 15:06:01 UTC

The following packages have significant changes to their size or dependencies:

@storybook/core

Before After Difference
Dependency count 46 46 0
Self size 19.24 MB 19.04 MB 🎉 -201 KB 🎉
Dependency size 14.29 MB 14.29 MB 0 B
Bundle Size Analyzer Link Link

storybook

Before After Difference
Dependency count 47 47 0
Self size 22 KB 22 KB 0 B
Dependency size 33.54 MB 33.33 MB 🎉 -201 KB 🎉
Bundle Size Analyzer Link Link

sb

Before After Difference
Dependency count 48 48 0
Self size 1 KB 1 KB 0 B
Dependency size 33.56 MB 33.36 MB 🎉 -201 KB 🎉
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 390 390 0
Self size 483 KB 483 KB 0 B
Dependency size 74.60 MB 74.40 MB 🎉 -201 KB 🎉
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 270 270 0
Self size 612 KB 612 KB 0 B
Dependency size 64.60 MB 64.39 MB 🎉 -201 KB 🎉
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 105 105 0
Self size 1.11 MB 1.11 MB 0 B
Dependency size 42.54 MB 42.34 MB 🎉 -201 KB 🎉
Bundle Size Analyzer Link Link

@JReinhold JReinhold merged commit d8bb943 into next Nov 19, 2024
64 of 69 checks passed
@JReinhold JReinhold deleted the jeppe/fix-manager-api-imports branch November 19, 2024 20:02
@github-actions github-actions bot mentioned this pull request Nov 19, 2024
6 tasks
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.

1 participant