Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated studio components are broken by default #37

Closed
johnpc opened this issue Aug 26, 2021 · 1 comment · Fixed by #40
Closed

Generated studio components are broken by default #37

johnpc opened this issue Aug 26, 2021 · 1 comment · Fixed by #40
Assignees

Comments

@johnpc
Copy link

johnpc commented Aug 26, 2021

I ran this script:

const rendererFactory = new StudioTemplateRendererFactory(
    (component) => new AmplifyRenderer(component)
  );

  const outputPathDir = path.resolve(path.join('.', 'src', 'ui-components'));
  const outputConfig = {
    outputPathDir,
    module: JSModuleEnum.CommonJS,
    compileTarget: CompileTargetEnum.ES6,
    outputFormat: JSOutputFormatEnum.tsx
  };

  const rendererManager = new StudioTemplateRendererManager(rendererFactory, outputConfig);
  rendererManager.renderSchemaToTemplate(schema);

The schema passed in was:

{
  appId: 'd37nrm8rzt3oek',
  bindingProperties: {},
  componentType: 'Box',
  environmentName: 'staging',
  id: 's-s4mU579Ycf6JGHwhqT',
  name: 'aawwdd',
  overrides: {},
  properties: {},
  variants: []
}

Which generated this component:

/* eslint-disable */
import React from "react";
import { View } from "@aws-amplify/ui-react";

export type aawwddProps = {} & CommonProps;
export default function aawwdd(props: aawwddProps): JSX.Element {
    return (<View {...props} {...getOverrideProps(props.overrides, "View")}></View>);
}

As you can see, the component code itself depends on calls to getOverrideProps, JSX.Element and CommonProps which are not imported. This means the component is not usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants