Skip to content

CSF: Only export definePreview from the framework#30676

Merged
kasperpeulen merged 3 commits intonextfrom
kasper/internal-react-preview
Feb 26, 2025
Merged

CSF: Only export definePreview from the framework#30676
kasperpeulen merged 3 commits intonextfrom
kasper/internal-react-preview

Conversation

@kasperpeulen
Copy link
Contributor

@kasperpeulen kasperpeulen commented Feb 26, 2025

Closes #

What I did

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 79.7 MB 79.7 MB 0 B -1.67 0%
initSize 79.7 MB 79.7 MB 0 B -1.67 0%
diffSize 97 B 97 B 0 B - 0%
buildSize 7.29 MB 7.29 MB 8 B -1.32 0%
buildSbAddonsSize 1.9 MB 1.9 MB 6 B Infinity 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.88 MB 1.88 MB 0 B 0.81 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.97 MB 3.97 MB 6 B 0.81 0%
buildPreviewSize 3.32 MB 3.32 MB 2 B -1.34 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.9s 7.7s 754ms -0.72 9.8%
generateTime 17.5s 23.5s 5.9s 1.36 🔺25.2%
initTime 4.1s 5.4s 1.3s 1.38 🔺24.1%
buildTime 7.8s 9.4s 1.5s 0.1 16.1%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6s 5.7s -250ms 0.22 -4.3%
devManagerResponsive 5.8s 5.4s -346ms 0.2 -6.3%
devManagerHeaderVisible 941ms 815ms -126ms 0.55 -15.5%
devManagerIndexVisible 1s 824ms -185ms 0.31 -22.5%
devStoryVisibleUncached 1.8s 2s 222ms 0.73 10.9%
devStoryVisible 1s 852ms -195ms 0.17 -22.9%
devAutodocsVisible 857ms 798ms -59ms 0.24 -7.4%
devMDXVisible 945ms 710ms -235ms -0.44 -33.1%
buildManagerHeaderVisible 905ms 690ms -215ms -0.61 -31.2%
buildManagerIndexVisible 910ms 752ms -158ms -0.43 -21%
buildStoryVisible 813ms 676ms -137ms -0.54 -20.3%
buildAutodocsVisible 638ms 563ms -75ms -0.53 -13.3%
buildMDXVisible 724ms 616ms -108ms 0.15 -17.5%

Greptile Summary

This PR adds deprecation notices to the definePreview function in both the React renderer and CSF implementation, directing users to use framework-specific versions instead.

  • Added @deprecated and @internal JSDoc tags to definePreview in code/renderers/react/src/preview.tsx
  • Added similar deprecation notices to definePreview in code/core/src/csf/csf-factories.ts
  • Part of a strategy to guide users toward framework-specific APIs rather than internal CSF implementations
  • Aligns with Storybook's migration path to encourage framework-specific implementations

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 | Greptile

@nx-cloud
Copy link

nx-cloud bot commented Feb 26, 2025

View your CI Pipeline Execution ↗ for commit 79dd554.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 2m 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-26 14:33:47 UTC

@kasperpeulen kasperpeulen added the maintenance User-facing maintenance tasks label Feb 26, 2025
@kasperpeulen kasperpeulen changed the title CSF: Deprecate definePreview from csf and react, so that it is clear that the framework one should be used. CSF: Only export definePreview from the framework Feb 26, 2025
@kasperpeulen kasperpeulen added patch:yes Bugfix & documentation PR that need to be picked to main branch ci:normal and removed ci:normal labels Feb 26, 2025
@kasperpeulen kasperpeulen merged commit e9b19b6 into next Feb 26, 2025
58 checks passed
@kasperpeulen kasperpeulen deleted the kasper/internal-react-preview branch February 26, 2025 14:53
kasperpeulen added a commit that referenced this pull request Feb 27, 2025
CSF: Only export definePreview from the framework
(cherry picked from commit e9b19b6)
@github-actions github-actions bot mentioned this pull request Feb 27, 2025
7 tasks
@github-actions github-actions bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Feb 27, 2025
@github-actions github-actions bot mentioned this pull request Feb 27, 2025
37 tasks
@ndelangen ndelangen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Oct 28, 2025
@ndelangen ndelangen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal maintenance User-facing maintenance tasks patch:done Patch/release PRs already cherry-picked to main/release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants