ArgsTable: Fix addon-docs useArgs to match new event structure

This commit is contained in:
Michael Shilman 2020-07-15 12:19:00 +08:00
parent f65ca37707
commit c687122902
2 changed files with 4 additions and 4 deletions

View File

@ -52,9 +52,9 @@ const useArgs = (storyId: string, storyStore: StoryStore): [Args, (args: Args) =
const { args: initialArgs } = story;
const [args, setArgs] = useState(initialArgs);
useEffect(() => {
const cb = (changedId: string, newArgs: Args) => {
if (changedId === storyId) {
setArgs(newArgs);
const cb = (changed: { storyId: string; args: Args }) => {
if (changed.storyId === storyId) {
setArgs(changed.args);
}
};
storyStore._channel.on(Events.STORY_ARGS_UPDATED, cb);

View File

@ -53,7 +53,7 @@ export const PassedToStory = (inputArgs) => {
);
};
PassedToStory.argTypes = { name: { defaultValue: 'initial' } };
PassedToStory.argTypes = { name: { defaultValue: 'initial', control: 'text' } };
PassedToStory.propTypes = {
args: PropTypes.shape({}).isRequired,