Skip to content

Commit

Permalink
Merge pull request #21951 from storybookjs/norbert/make-useargs-fault…
Browse files Browse the repository at this point in the history
…-tolerant

UI: Fix story data access to be more fault tolerant
  • Loading branch information
ndelangen authored and shilman committed Apr 6, 2023
1 parent 270a1b3 commit f5e8534
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/lib/manager-api/src/index.tsx
Expand Up @@ -486,7 +486,7 @@ export function useArgs(): [Args, (newArgs: Args) => void, (argNames?: string[])
const { getCurrentStoryData, updateStoryArgs, resetStoryArgs } = useStorybookApi();

const data = getCurrentStoryData();
const args = data.type === 'story' ? data.args : {};
const args = data?.type === 'story' ? data.args : {};
const updateArgs = useCallback(
(newArgs: Args) => updateStoryArgs(data as API_StoryEntry, newArgs),
[data, updateStoryArgs]
Expand Down

0 comments on commit f5e8534

Please sign in to comment.