Repository navigation
Core: Accept legacy addon namespaces in CSF factories - #35658
valentinpalkovic merged 8 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (9)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. WalkthroughPreview factory and wrapper types now accept legacy annotation namespaces as addon entries. Type inference continues to derive renderer types from typed addons. Tests cover legacy parameter composition and addon type checks. ChangesTyped preview addon entries
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change enables legacy namespace addons without a demonstrated new breakage. The reported omitted-addon inference behavior in core and Next.js predates this change; the PR appears ready for normal validation. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The broader addon contract uses the existing preview composition path. No new security boundary or privilege was identified, though downstream coverage is incomplete. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Guard on the inferred addon types instead of the entry list, so a list with only legacy namespaces no longer resolves to never. Narrow PreviewAddonEntry so an uncalled addon factory is rejected at the addons line again, and drop the unused phantom member on PreviewAddon.
…olve InferTypes now extracts the typed addons from the entries and infers their types in one conditional. Unlike the per-entry union-to-intersection, this resolves for an addons array cast to PreviewAddon<X>[] with a generic X, which the Next.js and TanStack wrappers rely on. React and Web Components cast their addons array the same way. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Previews must declare their addons, so the renderer and Angular wrappers take `addons` as a required field again, and the `= []` generic defaults added for omitted addons are dropped from core and the Next.js wrappers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 73 | 73 | 0 |
| Self size | 21.71 MB | 21.75 MB | 🚨 +38 KB 🚨 |
| Dependency size | 31.24 MB | 31.24 MB | 0 B |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 179 | 179 | 0 |
| Self size | 858 KB | 859 KB | 🚨 +192 B 🚨 |
| Dependency size | 87.15 MB | 87.19 MB | 🚨 +38 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 172 | 172 | 0 |
| Self size | 44 KB | 44 KB | 0 B |
| Dependency size | 85.64 MB | 85.68 MB | 🚨 +38 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
create-storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 74 | 74 | 0 |
| Self size | 1.07 MB | 1.07 MB | 0 B |
| Dependency size | 52.95 MB | 52.99 MB | 🚨 +38 KB 🚨 |
| Bundle Size Analyzer | node | node |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Closes #35571
What I did
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
/previewentry is imported as a namespace.npx storybook automigrate csf-factories.definePreview({ addons: [...] })configuration no longer collapses decorators, render functions, and parameters tonever.Documentation
MIGRATION.MD
No documentation change is needed because this makes the public types accept an annotation shape that Storybook already supports at runtime.
Checklist for Maintainers
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsqa:neededorqa:skipAI assistance disclosure: Codex was used to implement and validate this change.