storybook-addon-mock
storybook-addon-mock copied to clipboard
Suggestion: Refresh component when pausing/activating requests mocking.
Hi!
Could it be possible to add an option so that, when pausing/activating requests mocking, the story is refreshed. It would be very convenient for a React component that implement such hooks:
const ResourceDisplayer = () => {
const [resources, setResources] = useState<?Array<Resource>>(null);
const [displayError, setDisplayError] = useState<boolean>(false);
const fetchResources = useCallback(async () => {
try {
setDisplayError(false);
const resources = await getResources();
setResources(resources);
} catch (err) {
console.log(`Error when fetching resources: ${err}`);
setDisplayError(true);
}
}, []);
useEffect(
() => {
fetchResources();
},
[fetchResources]
);
return ( ... )
}