You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a great official Storybook plugin for MSW (msw-storybook-addon), but it doesn't support sophisticated documentation of multiple stories (which use the same endpoints) within the same page.
This could be fixed on a architecture level (isolating every Story within in an iframe with independent workers), but imho it can be fixed in a simpler way similar to how CSS-in-JS usually fixed "global CSS" (by a proper "scoping" concept).
I'm a new MSW user and if I saw correctly it is currently only possible to match by method and URL. It would actually be nice to match by HTTP Headers as well. It would be pretty easy to append a Story-specific unique HTTP Header to every request. If this would be the case I could easily match against it. With more sophisticated matching options we could support mswjs/msw-storybook-addon#83 in user land.
In our application code we would need to access this scope (e.g. via a React hook) and append it to all requests (e.g. in an Axios interceptor, if you use Axios).
The text was updated successfully, but these errors were encountered:
Scope
Adds a new behavior
Compatibility
Feature description
There is a great official Storybook plugin for MSW (msw-storybook-addon), but it doesn't support sophisticated documentation of multiple stories (which use the same endpoints) within the same page.
This could be fixed on a architecture level (isolating every Story within in an iframe with independent workers), but imho it can be fixed in a simpler way similar to how CSS-in-JS usually fixed "global CSS" (by a proper "scoping" concept).
I'm a new MSW user and if I saw correctly it is currently only possible to match by method and URL. It would actually be nice to match by HTTP Headers as well. It would be pretty easy to append a Story-specific unique HTTP Header to every request. If this would be the case I could easily match against it. With more sophisticated matching options we could support mswjs/msw-storybook-addon#83 in user land.
There's definitely room for improving the API (e.g. by providing a
rest
that is already scoped):In our application code we would need to access this
scope
(e.g. via a React hook) and append it to all requests (e.g. in an Axios interceptor, if you use Axios).The text was updated successfully, but these errors were encountered: