From 189de5b706303c6d4a1629616f2186db257243a9 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 5 Apr 2023 16:55:47 +0200 Subject: [PATCH] Make the access of data fault tolerant because: https://github.com/storybookjs/storybook/issues/21899#issuecomment-1497538942 --- code/lib/manager-api/src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/manager-api/src/index.tsx b/code/lib/manager-api/src/index.tsx index baa84f691776..ef5107c01ef6 100644 --- a/code/lib/manager-api/src/index.tsx +++ b/code/lib/manager-api/src/index.tsx @@ -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]