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

do not reset handlers if msw is not defined for story, fix #25 #79

Closed gazs closed 2 years ago

gazs commented 2 years ago

Fixes https://github.com/mswjs/msw-storybook-addon/issues/25

Ensuring that api.resetHandlers() is only called if msw is defined as a parameter of a story solves the issue where if any loaded story file didn't have an msw parameter defined the browser window would hang.

While this solves the issue in my storybook, I am not sure if it can have any unintended effects, please let me know!

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/mswjs/msw-storybook-addon/GM8Hxc57cmqR4LdARhQMh5n7dy4f
✅ Preview: https://msw-storybook-addon-git-fork-gazs-fix-issue-25-freezing-mswjs.vercel.app

gazs commented 2 years ago

Turns out this was not the root cause in the end, but rather a conflicting storybook addon.

corbinschwartz commented 2 years ago

@gazs which storybook addon was conflicting?