Skip to content

Commit

Permalink
fix: workarounds sb issues with current story on mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Nov 13, 2020
1 parent 53f2e75 commit 38684a3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions integrations/storybook/src/panel/AddonPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ export const AddonPanel: React.FC<AddonPanelProps> = ({
setStoryId(props.storyId);
};
const { id } = api.getCurrentStoryData() || {};
console.log(api.storyId);
setStoryId(id);
channel.on(SET_CURRENT_STORY, onChangeStory);
return () => channel.off(SET_CURRENT_STORY, onChangeStory);
}, [api, channel]);
const docId = storyId && store ? store.stories[storyId].doc : undefined;
return active && storyId ? (
<BlockContextProvider store={store} storyId={storyId} docId={docId}>
const docId =
storyId && store
? store.stories[storyId]
? store.stories[storyId].doc
: storyId
: undefined;
return active && docId ? (
<BlockContextProvider
store={store}
storyId={storyId !== docId ? storyId : undefined}
docId={docId}
>
{children}
</BlockContextProvider>
) : null;
Expand Down

0 comments on commit 38684a3

Please sign in to comment.