Skip to content

Commit

Permalink
fix: failing unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pianist038801 <steven@union.ai>
  • Loading branch information
Pianist038801 committed Aug 23, 2021
1 parent 7431975 commit 38576cf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/Launch/LaunchForm/StructInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ export const StructInput: React.FC<InputProps> = props => {
let jsonFormRenderable = false;
let parsedJson: PrimitiveType = {};

if (literalType?.metadata) {
if (
literalType?.metadata?.fields?.definitions?.structValue?.fields
?.DatumSchema
) {
parsedJson = protobufValueToPrimitive(
literalType.metadata.fields.definitions
literalType.metadata.fields.definitions.structValue.fields
.DatumSchema
);
if (parsedJson.DatumSchema) jsonFormRenderable = true;

if (parsedJson) jsonFormRenderable = true;
}

return jsonFormRenderable ? (
Expand All @@ -54,7 +59,7 @@ export const StructInput: React.FC<InputProps> = props => {
/>
<CardContent>
<Form
schema={parsedJson.DatumSchema}
schema={JSON.parse(JSON.stringify(parsedJson))}
formData={paramData}
onChange={onFormChange}
>
Expand Down

0 comments on commit 38576cf

Please sign in to comment.