docs(ui): add stories for Recharging page#2496
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds MSW-based Storybook request mocking: a service worker, two HTTP handlers, Storybook MSW initialization/loader, story variants that enable/disable mocks, and dependency/catalog/knip configuration for MSW tooling. Changes
Sequence DiagramsequenceDiagram
participant Story as Story Instance
participant Storybook as Storybook Runtime
participant MSWLoader as mswLoader / Addon
participant SW as Service Worker
participant Handlers as MSW Handlers
participant Network as Browser Network
Story->>Storybook: Load story (with msw params)
Storybook->>MSWLoader: invoke mswLoader / initialize()
MSWLoader->>SW: register/activate worker
Story->>Network: fetch /api/...
Network->>SW: intercepted request
SW->>Handlers: route to handler or passthrough
Handlers-->>SW: mocked Response
SW-->>Network: respond to request
Network-->>Story: story receives response
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
| 📦 Package | 📋 Versions |
|---|---|
| h3 | 5 versions
h3@2.0.1-rc.11 h3@2.0.1-rc.16 h3@2.0.1-rc.20 |
| glob | 5 versions
|
| @rolldown/pluginutils | 5 versions
@rolldown/pluginutils@1.0.0-rc.9 |
| @oxc-project/types | 6 versions
|
💡 To find out what depends on a specific package, run: pnpm -r why example-package
📊 Dependency Size Changes
Warning
This PR adds 13 MB of new dependencies, which exceeds the threshold of 200 kB.
| 📦 Package | 📏 Size |
|---|---|
| msw@2.13.2 | 5.3 MB |
| tldts@7.0.28 | 3.1 MB |
| @mswjs/interceptors@0.41.3 | 1.5 MB |
| graphql@16.13.2 | 1.4 MB |
| tough-cookie@6.0.1 | 755.4 kB |
| tldts-core@7.0.28 | 239.7 kB |
| headers-polyfill@4.0.3 | 133.8 kB |
| @inquirer/core@10.3.2 | 103 kB |
| rettime@0.10.1 | 71.1 kB |
| cookie@1.1.1 | 60.5 kB |
| strict-event-emitter@0.5.1 | 45.7 kB |
| @inquirer/figures@1.0.15 | 38.2 kB |
| @open-draft/deferred-promise@2.2.0 | 25.4 kB |
| @open-draft/logger@0.3.0 | 24.3 kB |
| outvariant@1.4.3 | 23.2 kB |
| msw-storybook-addon@2.0.7 | 22.9 kB |
| yoctocolors-cjs@2.1.3 | 11 kB |
| @open-draft/until@2.1.0 | 10.1 kB |
| @inquirer/confirm@5.1.21 | 9.5 kB |
| wrap-ansi@6.2.0 | 9.5 kB |
| @inquirer/type@3.0.10 | 9.4 kB |
| until-async@3.0.2 | 9.2 kB |
| @inquirer/ansi@1.0.2 | 8 kB |
| mute-stream@2.0.0 | 6.5 kB |
| is-node-process@1.2.0 | 6 kB |
| @types/statuses@2.0.6 | 4.9 kB |
| cli-width@4.1.0 | 4.8 kB |
Total size change: 13 MB
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| msw: | ||
| 'msw': '^2.13.2' |
There was a problem hiding this comment.
how come this has it's own catalog?
There was a problem hiding this comment.
Fair question. Since MSW has other uses and isn’t specifically tied to the Storybook dependency update cycle I figured it would be better out of the Storybook catalog.
Maybe that’s a premature move. Since right now I was only adding the MSW to the .storybook/public/.
If there is preference that it’s in its moved into the Storybook catalog, moved to be part of the default catalog, or not defined in catalog at all I’d be fine with whatever. I’ve only used catalogs for a short time. So there’s probably best practices I haven’t fully internalized yet.
There was a problem hiding this comment.
we can leave as is for now! if we want later we can always merge it into storybook/general one 🙏 I only asked as it's currently on it's own
🔗 Linked issue
#2150
🧭 Context
This would enable a storybook mock page, storybook a11y checks, and chromatic visual regression tests for this page as documented by the storybook stories.
📚 Description
Adds stories for Recharging page.
Adds MSW and MSW storybook addon for mocking API calls on pages in Storybook. (Can be broken into separate PR if this feels too large.)