Skip to content

Commit

Permalink
Update to use resolveOf
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Jan 19, 2023
1 parent 7fa20f2 commit 3f1154e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions code/ui/blocks/src/blocks/Source.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ export const useSourceProps = (
// The check didn't actually change the type.
let stories: PreparedStory[] = storiesFromIds as PreparedStory[];
if (props.of) {
const resolved = docsContext.resolveModuleExport(props.of);
if (resolved.type !== 'story')
throw new Error(`Invalid value passed to the 'of' prop, it should be a story export.`);
const resolved = docsContext.resolveOf(props.of, ['story']);
stories = [resolved.story];
} else if (stories.length === 0) {
stories = [docsContext.storyById()];
Expand Down

0 comments on commit 3f1154e

Please sign in to comment.