-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Core: Make subtype an optional property on an index input
#32602
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
Conversation
📝 WalkthroughWalkthroughStory index handling was adjusted: StoryIndexInput.subtype became optional, StoryIndexGenerator computes an effective Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Indexer as Indexer (produces IndexInput)
participant SIG as StoryIndexGenerator
participant Output as Story Index
Note over Indexer: Emits IndexInput with optional `subtype` and other fields
Indexer->>SIG: IndexInput { type, subtype?, componentPath?, exportName?, ... }
rect rgba(200,230,210,0.25)
Note over SIG: Normalize and construct entry
SIG->>SIG: cast inputs to StoryIndexInput[]
SIG->>SIG: subtype := input.subtype ?? 'story'
SIG->>SIG: build entry using subtype and other fields
SIG->>SIG: if subtype === 'test' then assign parent/parentName
SIG->>SIG: if input.exportName then assign exportName
end
SIG->>Output: emit StoryIndexEntry (with optional componentPath/exportName/subtype for tests)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (2)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
docs/api/main-config/main-config-indexers.mdx (1)
499-499: Remove trailing blank line.This appears to be an unintentional whitespace change.
Apply this diff:
- </details>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
code/core/src/core-server/utils/StoryIndexGenerator.ts(2 hunks)code/core/src/types/modules/indexer.ts(1 hunks)docs/api/main-config/main-config-indexers.mdx(3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Adhere to ESLint and Prettier rules across all JS/TS source files
Files:
code/core/src/types/modules/indexer.tscode/core/src/core-server/utils/StoryIndexGenerator.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Fix type errors and prefer precise typings instead of using any or suppressions, consistent with strict mode
Files:
code/core/src/types/modules/indexer.tscode/core/src/core-server/utils/StoryIndexGenerator.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Danger JS
- GitHub Check: normal
- GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (2)
code/core/src/core-server/utils/StoryIndexGenerator.ts (1)
442-462: LGTM! Clean implementation of optional subtype with sensible defaults.The logic correctly:
- Defaults to
'story'wheninput.type !== 'story'- Falls back to
'story'wheninput.subtypeis undefined- Uses the computed
subtypeconsistently throughout the entry constructionThe conditional at line 457 properly uses the computed
subtypevalue instead of the rawinput.subtype.code/core/src/types/modules/indexer.ts (1)
137-137: LGTM! Type definition correctly reflects optional nature.The optional marker correctly aligns with the PR objective and the default handling logic in
StoryIndexGenerator.ts.
|
View your CI Pipeline Execution ↗ for commit 06a15c4
☁️ Nx Cloud last updated this comment at |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
kylegach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the API reference. I made some suggested changes that need to be addressed prior to merging.
Co-authored-by: Kyle Gach <[email protected]>
|
Failed to publish canary version of this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/18203285428 |
What I did
Made
subtypeoptional, defaulting to'story'on index inputs. This doesn't change what is actually in the index, only what indexers are required to specify.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
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.tsMake 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 pull request has been released as version
0.0.0-pr-32602-sha-16d7f80f. Try it out in a new sandbox by runningnpx [email protected] sandboxor in an existing project withnpx [email protected] upgrade.More information
0.0.0-pr-32602-sha-16d7f80fjeppe/optional-subtype16d7f80f1759433050)To request a new release of this pull request, mention the
@storybookjs/coreteam.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=32602Summary by CodeRabbit
New Features
Bug Fixes
Documentation
subtypefield, its default, and examples.