Skip to content

Commit

Permalink
Merge pull request #13845 from somenickname/12357_fix_first_tab_named…
Browse files Browse the repository at this point in the history
…_story

Addon-docs: Fix ArgsTable tab renamed to `Story` when using args
  • Loading branch information
shilman authored Feb 20, 2021
2 parents 7a12579 + 6926301 commit 3ea21b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addons/docs/src/blocks/ArgsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ export const StoryTable: FC<
}
storyArgTypes = filterArgTypes(storyArgTypes, include, exclude);

const mainLabel = getComponentName(component) || 'Story';

// eslint-disable-next-line prefer-const
let [args, updateArgs, resetArgs] = useArgs(storyId, storyStore);
let tabs = { Story: { rows: storyArgTypes, args, updateArgs, resetArgs } } as Record<
let tabs = { [mainLabel]: { rows: storyArgTypes, args, updateArgs, resetArgs } } as Record<
string,
PureArgsTableProps
>;
Expand All @@ -170,7 +172,6 @@ export const StoryTable: FC<
}

if (component && (!storyHasArgsWithControls || showComponent)) {
const mainLabel = getComponentName(component);
tabs = addComponentTabs(tabs, { [mainLabel]: component }, context, include, exclude);
}

Expand Down

0 comments on commit 3ea21b7

Please sign in to comment.