Skip to content

docs(ui): add stories for Recharging page#2496

Merged
ghostdevv merged 4 commits intonpmx-dev:mainfrom
cylewaitforit:sb-recharging-page
Apr 14, 2026
Merged

docs(ui): add stories for Recharging page#2496
ghostdevv merged 4 commits intonpmx-dev:mainfrom
cylewaitforit:sb-recharging-page

Conversation

@cylewaitforit
Copy link
Copy Markdown
Contributor

@cylewaitforit cylewaitforit commented Apr 12, 2026

🔗 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.)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs.npmx.dev Ready Ready Preview, Comment Apr 14, 2026 0:49am
npmx.dev Ready Ready Preview, Comment Apr 14, 2026 0:49am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Apr 14, 2026 0:49am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9f6c7658-0ff5-45e6-8dac-8d6a63e33c84

📥 Commits

Reviewing files that changed from the base of the PR and between c9c0b1e and d539b10.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • package.json

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Integrated Mock Service Worker (MSW) into Storybook to intercept and mock API requests for stories.
    • Added mocked endpoints for repository stats and contributors to support realistic story data.
    • Added story variants for About and Recharging pages to show behaviour with and without mocked API data.
  • Chores

    • Added MSW and MSW Storybook addon plus related Storybook loader and workspace configuration.

Walkthrough

Adds 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

Cohort / File(s) Summary
MSW Service Worker
\.storybook/.public/mockServiceWorker.js
Adds full MSW service-worker script: client registration/keepalive, message handling (activate/unregister/mock control), fetch interception with passthrough/mock resolution, response serialization and lifecycle messaging to clients.
MSW Request Handlers
\.storybook/handlers.ts
Adds repoStatsHandler (GET /api/repo-stats) and contributorsHandler (GET /api/contributors) returning static JSON mock payloads.
Storybook Integration
\.storybook/preview.ts
Initialises msw-storybook-addon via initialize() and registers mswLoader in Storybook preview loaders.
Story Files
app/pages/about.stories.ts, app/pages/recharging.stories.ts
Registers handlers as default MSW handlers for stories; adds story variants disabling MSW at story level (parameters.msw.handlers = []) and adds new recharging stories file.
Dependency & Config
package.json, pnpm-workspace.yaml, knip.ts
Adds msw and msw-storybook-addon to devDependencies/catalogs and registers the MSW service-worker entry in Knip workspace config.

Sequence Diagram

sequenceDiagram
    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
Loading

Possibly related PRs

Suggested reviewers

  • JReinhold
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title describes adding stories for the Recharging page, which aligns with the main changes in the PR, though it does not mention the significant MSW setup work also included.
Description check ✅ Passed The description directly addresses the changeset by explaining the addition of Recharging page stories and the MSW integration for mocking API calls in Storybook.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cylewaitforit
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 12, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

⚠️ Dependency Count

This PR adds 27 new dependencies (2273 → 2300), which exceeds the threshold of 15.

⚠️ Duplicate Dependencies (found: 4, threshold: 4)

📦 Package 📋 Versions
h3
5 versions
  • root@
    • @nuxt/fonts@0.14.0
      • fontless@0.2.1
        • unstorage@1.17.5
          • h3@1.15.11

  • root@
    • @nuxt/fonts@0.14.0
      • h3@1.15.8

h3@2.0.1-rc.11
h3@2.0.1-rc.16
h3@2.0.1-rc.20
glob
5 versions
  • root@
    • @nuxt/test-utils@4.0.0
      • @vue/test-utils@2.4.6
        • js-beautify@1.15.4
          • glob@10.5.0

  • root@
    • @vite-pwa/nuxt@1.1.1
      • vite-plugin-pwa@1.2.0
        • workbox-build@7.4.0
          • glob@11.1.0

  • root@
    • @vueuse/nuxt@14.2.1
      • ...
        • nitropack@2.13.3
          • @vercel/nft@1.5.0
            • glob@13.0.6

  • root@
    • vue-i18n-extract@2.0.7
      • dot-object@2.1.5
        • glob@7.2.3

  • root@
    • vue-i18n-extract@2.0.7
      • glob@8.1.0

@rolldown/pluginutils
5 versions
  • root@
    • @vueuse/nuxt@14.2.1
      • ...
        • rollup-plugin-visualizer@7.0.1
          • rolldown@1.0.0-rc.12
            • @rolldown/pluginutils@1.0.0-rc.12

  • root@
    • @vueuse/nuxt@14.2.1
      • nuxt@4.3.1
        • @nuxt/vite-builder@4.3.1
          • @vitejs/plugin-vue-jsx@5.1.5
            • @rolldown/pluginutils@1.0.0-rc.13

  • root@
    • @vueuse/nuxt@14.2.1
      • nuxt@4.3.1
        • @nuxt/vite-builder@4.3.1
          • @vitejs/plugin-vue@6.0.5
            • @rolldown/pluginutils@1.0.0-rc.2

  • root@
    • @nuxt/a11y@1.0.0-alpha.1
      • @nuxt/devtools-kit@3.2.4
        • vite@8.0.0-beta.18
          • rolldown@1.0.0-rc.8
            • @rolldown/pluginutils@1.0.0-rc.8

@rolldown/pluginutils@1.0.0-rc.9
@oxc-project/types
6 versions
  • root@
    • @vueuse/nuxt@14.2.1
      • nuxt@4.3.1
        • oxc-parser@0.112.0
          • @oxc-project/types@0.112.0

  • root@
    • @nuxt/a11y@1.0.0-alpha.1
      • @nuxt/devtools-kit@3.2.4
        • vite@8.0.0-beta.18
          • rolldown@1.0.0-rc.8
            • @oxc-project/types@0.115.0

  • root@
    • knip@6.0.5
      • oxc-parser@0.120.0
        • @oxc-project/types@0.120.0

  • root@
    • @vueuse/nuxt@14.2.1
      • ...
        • rollup-plugin-visualizer@7.0.1
          • rolldown@1.0.0-rc.12
            • @oxc-project/types@0.122.0

  • root@
    • vite-plus@0.1.16
      • @oxc-project/types@0.123.0

  • root@
    • @nuxtjs/i18n@10.2.3
      • oxc-parser@0.95.0
        • @oxc-project/types@0.95.0

💡 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
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Comment on lines +44 to +45
msw:
'msw': '^2.13.2'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come this has it's own catalog?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ghostdevv ghostdevv enabled auto-merge April 14, 2026 00:50
@ghostdevv ghostdevv added this pull request to the merge queue Apr 14, 2026
Merged via the queue into npmx-dev:main with commit 236ba7d Apr 14, 2026
22 checks passed
@github-actions github-actions bot mentioned this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants