mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-20 05:02:37 +08:00
ArgsTable: Fix addon-docs useArgs to match new event structure
This commit is contained in:
parent
f65ca37707
commit
c687122902
@ -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);
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user