From d3cabc6259d2649a30c58004ae7f01a63a99b2ba Mon Sep 17 00:00:00 2001 From: Wilson Chen Date: Tue, 17 Oct 2023 23:28:02 -0700 Subject: [PATCH] Removed getPrimaryFromResolvedOf function --- code/ui/blocks/src/blocks/Primary.tsx | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/code/ui/blocks/src/blocks/Primary.tsx b/code/ui/blocks/src/blocks/Primary.tsx index 0175af5b9e61..7d1364f2dc51 100644 --- a/code/ui/blocks/src/blocks/Primary.tsx +++ b/code/ui/blocks/src/blocks/Primary.tsx @@ -18,26 +18,6 @@ interface PrimaryProps { of?: Of; } -const getPrimaryFromResolvedOf = (resolvedOf: ReturnType) => { - switch (resolvedOf.type) { - case 'meta': { - return resolvedOf.csfFile.stories[0] || null; - } - case 'component': { - throw new Error( - `Unsupported module type. Primary's \`of\` prop only supports \`meta\`, got: ${ - (resolvedOf as any).type - }` - ); - } - default: { - throw new Error( - `Unrecognized module type resolved from 'useOf', got: ${(resolvedOf as any).type}` - ); - } - } -}; - export const Primary: FC = (props) => { const { name, of } = props; @@ -50,7 +30,7 @@ export const Primary: FC = (props) => { let story; if (of) { const resolvedOf = useOf(of || 'meta', ['meta']); - story = getPrimaryFromResolvedOf(resolvedOf); + story = resolvedOf.csfFile.stories[0] || null; } if (!story) {