grommet/grommet-designer

[Bug] A reference without setting a component errors out when generating

jjwilliams42 opened this issue · 1 comments

I accidentally added a reference to my design, then tried to generate code - but nothing is ever displayed.

I think it is because a null check needs to happen here (in code.js):

Old:

const nextReferenceDesign = getReferenceDesign(importsArg, component);
result = componentToJSX({
        screen,
        id: component.props.component,
        indent,
        referenceDesign: nextReferenceDesign,
      });

New:

const nextReferenceDesign = getReferenceDesign(importsArg, component);
result = nextReferenceDesign ? componentToJSX({
        screen,
        id: component.props.component,
        indent,
        referenceDesign: nextReferenceDesign,
      }) : '';

Incoming PR ...

Closing since PR was merged