Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit 212aa9c

Browse files
committed
feat: add error handling in global render function
1 parent 4a6c010 commit 212aa9c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/utils.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ import type { FunctionComponent } from 'react';
44
import type { Story } from '@storybook/react';
55

66
export const globalRender: Story = (args, { parameters }) => {
7+
if (!parameters.component) {
8+
throw new Error(`
9+
Could not render story due to missing 'component' property in Meta.
10+
Please refer to https://github.com/storybookjs/testing-react#csf3
11+
`);
12+
}
13+
714
const Component = parameters.component as FunctionComponent;
815
return <Component {...args} />;
916
};

0 commit comments

Comments
 (0)