box-ui-elements
box-ui-elements copied to clipboard
chore(storybook): migrate to storybook v9
Summary by CodeRabbit
- Chores
- Updated Storybook-related dependencies to the latest versions for improved stability and compatibility.
- Removed several Storybook addons and simplified storybook stories by eliminating interactive knobs and dynamic controls.
- Updated import paths in Storybook configuration and stories for improved consistency.
- Added a new Webpack plugin to enhance build compatibility.
- Refined UI component stories to use static props, removing interactive controls for a more consistent preview experience.
- Improved mock service worker script for better request handling and client management.
- Adjusted rendering logic in item lists to display options column only when applicable.
- Modernized React component rendering across multiple wrappers to use React 18's concurrent rendering API.
- Enhanced component unmounting logic for improved cleanup in wrappers.
Walkthrough
This update upgrades Storybook and related packages to newer major versions, removes deprecated Storybook addons, updates import paths, and simplifies Storybook stories by eliminating dynamic knobs and actions. It also adds the node-polyfill-webpack-plugin, adjusts Webpack and test configurations, and cleans up type stubs and test support files.
Changes
| Files/Paths | Change Summary |
|---|---|
| package.json, .circleci/config.yml | Storybook, Cypress, MSW, and related devDependencies upgraded/removed/added; CI Docker image bumped. |
| .storybook/customTheme.ts, .storybook/manager.ts, .storybook/main.ts | Storybook import paths updated; addons removed; node-polyfill-webpack-plugin added to Webpack config. |
| scripts/webpack.config.js | node-polyfill-webpack-plugin added to Webpack plugins. |
| flow-typed/npm/@storybook/addon-actions_vx.x.x.js, .../addon-knobs_vx.x.x.js, .../preview-api_vx.x.x.js | Flow type stubs for removed Storybook addons deleted. |
| src/components/button/Button.stories.tsx, .../PrimaryButton.stories.tsx, .../PlainButton.stories.tsx, .../ButtonGroup.stories.tsx, src/icons/icons.stories.tsx | Knobs/actions imports removed or updated; stories simplified to static props; dynamic controls removed. |
| src/components/nav-sidebar/NavSidebar.stories.js, .../PreviewDialog.stories.tsx, .../DeleteConfirmationDialog.stories.tsx, .../RenameDialog.stories.tsx, .../ShareDialog.stories.tsx | Storybook import paths updated. |
| src/elements/content-explorer/stories/ContentExplorer.mdx, .../ContentPicker.mdx, .../ContentPreview.mdx, .../ContentSharing.mdx, .../BoxAISideBar.mdx, .../ContentSidebar.mdx, .../MetadataSidebar.mdx, .../ContentUploader.mdx | Storybook MDX Meta import paths updated. |
| src/elements/content-explorer/stories/tests/ContentExplorer-visual.stories.js, .../ContentPicker-visual.stories.js, .../ContentPreview-visual.stories.js, .../ContentUploader-visual.stories.js, .../BoxAISidebar-visual.stories.tsx, .../MetadataSidebarRedesign-visual.stories.tsx, .../MetadataSidebarRedesign.stories.tsx | Storybook test utility import paths updated; some test exports removed or reordered. |
| src/elements/content-picker/ContentPicker.js, src/elements/content-picker/ItemList.js | itemActions default prop removed; rendering now checks for non-empty itemActions array. |
| src/components/avatar/tests/Avatar.test.tsx, src/components/time-input/tests/TimeInput.test.tsx | React and act imports consolidated. |
| .gitignore | Added test/screenshots/ and test/videos/ to ignored files. |
| test/integration/content-preview/ContentPreview.e2e.cy.js, .../TaskForm.e2e.cy.js, .../OpenWith.int.cy.js | Localization function alias updated from l to localize. |
| test/support/commands.js | Re-adds Cypress custom command visitStorybook. |
| test/support/events.js, test/support/index.js | Adds handler to ignore AbortError exceptions in Cypress; imports events module. |
| .storybook/public/mockServiceWorker.js | MSW worker script updated with new features, improved messaging, and serialization. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant Storybook UI
participant Webpack
participant NodePolyfillPlugin
User->>Storybook UI: Loads Storybook stories
Storybook UI->>Webpack: Requests build
Webpack->>NodePolyfillPlugin: Apply polyfills
NodePolyfillPlugin-->>Webpack: Polyfills injected
Webpack-->>Storybook UI: Serves built stories
User-->>Storybook UI: Interacts with static stories (no knobs/actions)
Possibly related PRs
- box/box-ui-elements#4116: Removes
@storybook/addon-stylingand replaces it with@storybook/addon-styling-webpack, overlapping with this PR's broader Storybook dependency and configuration updates.
Suggested labels
ready-to-merge
Suggested reviewers
- jpan-box
Poem
🐇✨
Upgrading stories, the bunnies hop,
Out with old knobs, let new builds pop!
Polyfills sprinkled, the plugins align,
Testers and stories now smoothly entwine.
With static tales and imports anew,
This rabbit says, "Storybook, thank you!"
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between c1dce362a821b5400824eb04c4c78de7bf7498c1 and 74fe41b8c3c611f1839e745701eb8e781fbcd825.
📒 Files selected for processing (2)
src/elements/content-explorer/stories/tests/ContentExplorer-visual.stories.js(1 hunks)src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- src/elements/content-explorer/stories/tests/ContentExplorer-visual.stories.js
- src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: lint_test_build
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Summary
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@mergifyio requeue
requeue