Skip to content

Commit

Permalink
fix: update imports and current doc lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Nov 28, 2020
1 parent 5615973 commit 893293b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/store/src/state/context/components.ts
Expand Up @@ -116,8 +116,9 @@ export const useComponent = ({
name,
}: ComponentInputProps): Component | undefined => {
const story = useStory({ id: name });
const currentDoc = useCurrentDocument();
const store = useStore();
const doc = story && story.doc ? store.docs[story.doc] : undefined;
const doc = story && story.doc ? store.docs[story.doc] : currentDoc;
let component;
if (of === CURRENT_STORY) {
component = story ? story.component : doc?.component;
Expand Down
Expand Up @@ -10,7 +10,7 @@ image: /static/external-component-source.jpg
---
import { Button } from 'theme-ui';
import { ControlTypes } from '@component-controls/core';
import { PropsTable, ComponentDeps, ComponentSource, Playground, Story } from '@component-controls/blocks';
import { PropsTable, ComponentExternalDependencies, ComponentSource, Playground, Story } from '@component-controls/blocks';
import noSetupImg from './media/external-component-no-setup.jpg';
import sourceCodeImg from './media/external-component-source.jpg';

Expand Down Expand Up @@ -166,7 +166,7 @@ As a result, we should now see a full PropsTable for the `Button` component popu

As well as the component's dependencies table:

<ComponentDeps of={Button} />
<ComponentExternalDependencies of={Button} />


## Component playground
Expand Down

0 comments on commit 893293b

Please sign in to comment.