-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get addon to work. Using react-query v4 and nextjs #118
Comments
I'm having issues too. made it work with this workaround: #119 (comment) |
Got it working, instead of using mswLoader, I'm now using mswDecorator. Not sure why. |
Hey @conradogarciaberrotaran and @Mexflubber thanks for reporting this. |
Thank you @yannbf , I've just tried to replicate the issue, basically I ran:
Added the public route of my nextjs to the staticDirs in main.js and added this story: import { rest } from 'msw';
import { useEffect, useState } from 'react';
const SomeComponent = () => {
const [response, setResponse] = useState(null);
useEffect(() => {
fetch("/api/some-endpoint")
.then((response) => response.json())
.then((data) => setResponse(data));
}, []);
return <div>{response?.firstName}</div>;
};
export default {
title: 'Example/SomeComponent',
component: SomeComponent,
};
export const Something = {
parameters: {
msw: {
handlers: [
rest.get('/api/some-endpoint', (req, res, ctx) => {
return res(
ctx.json({
firstName: 'Neil',
lastName: 'Maverick',
})
)
}),
]
},
}
};
export const SomethingElse = {
parameters: {
msw: {
handlers: [
rest.get('/api/some-endpoint', (req, res, ctx) => {
return res(
ctx.json({
firstName: 'bob',
lastName: 'Maverick',
})
)
}),
]
},
}
}; And it's working correctly. |
Updating the libraries fixed my issue, I updated msw, storybook and msw-storybook-addon to latest |
That's great! Thank you for reporting back. I will be closing this issue, let me know if this happens again. |
Thank you! |
Following the instructions none of my stories in storybook load, they all show a spinning circle.
I'm using nextjs and I'm using the "@storybook/nextjs" framework.
The text was updated successfully, but these errors were encountered: