mswjs / msw-storybook-addon

Mock API requests in Storybook with Mock Service Worker.
https://msw-sb.vercel.app
MIT License
408 stars 39 forks source link

Fix: Make sure MSW loader is resolved only when mocking is enabled #157

Closed yannbf closed 4 months ago

yannbf commented 4 months ago

Closes #89

This PR finally solves the inconsistency issues that mswLoaders were trying to initially solve. Before, they were waiting for the service worker to be registered, but we later found out it wasn't enough. Thanks to @kettanaito the loaders should now wait properly.

I manually patched msw to take much longer to register, and Storybook waited and worked as intended with the changes from this PR.

📦 Published PR as canary version: 2.0.3--canary.157.8ab54e9.0
:sparkles: Test out this PR locally via: ```bash npm install msw-storybook-addon@2.0.3--canary.157.8ab54e9.0 # or yarn add msw-storybook-addon@2.0.3--canary.157.8ab54e9.0 ```
vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
msw-storybook-addon ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 12, 2024 10:09am
github-actions[bot] commented 4 months ago

:rocket: PR was released in v2.0.3 :rocket: