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

Demos Doesn't Work #87

Closed welcomzyh1234 closed 1 year ago

welcomzyh1234 commented 2 years ago

Hi, I want to mock hooks via react-query, and referred the demos in this package https://github.com/mswjs/msw-storybook-addon/tree/main/packages/docs/src/demos/react-query for implementation. However, I found the demos are not working either on my side, or on official page https://msw-sb.vercel.app/?path=/story/demos-react-router-rq--mocked-film-subsection. We can see that for Default, success and error cases, they are actually all showing successful response from https://swapi.dev/api/films/, and the mocked data is not reflected at all.

Can anyone help me understand why this is happening and how can I properly mock react-query hooks ?

welcomzyh1234 commented 2 years ago

Actually, from https://msw-sb.vercel.app/?path=/story/demos-apollo--default-behavior, we can find that not only react query demo is not working, all of the demos are not working properly.

hstevanoski commented 2 years ago

It turns out you don't need this plugin to integrate Storybook and MSW. Instead, the integration seems a lot more straightforward and it doesn't rely on any third-party packages (which is cool in itself): https://egghead.io/lessons/next-js-integrate-msw-and-storybook

yannbf commented 1 year ago

Hey, the demos are now updated and should be working. Thank you!