Skip to content

Commit

Permalink
fix: correctly coerce defaultValue when rendering LaunchPlan details (
Browse files Browse the repository at this point in the history
#578)

fix: correctly coerce defaultValue when rendering LaunchPlan details

Signed-off-by: Rahul Mehta <[email protected]>

Signed-off-by: Rahul Mehta <[email protected]>
  • Loading branch information
rahul-theorem authored Sep 6, 2022
1 parent dc1c73f commit 7e3c6db
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/zapp/console/src/components/Entities/EntityInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ import * as React from 'react';
import t from './strings';
import { transformLiterals } from '../Literals/helpers';

const coerceDefaultValue = (value: string | object | undefined): string | undefined => {
if (typeof value === 'object') {
return JSON.stringify(value);
}
return value;
};

const useStyles = makeStyles((theme: Theme) => ({
header: {
marginBottom: theme.spacing(1),
Expand Down Expand Up @@ -179,7 +186,7 @@ export const EntityInputs: React.FC<{
<TableCell align="center">
{required ? <CheckIcon fontSize="small" /> : ''}
</TableCell>
<TableCell>{defaultValue || '-'}</TableCell>
<TableCell>{coerceDefaultValue(defaultValue) || '-'}</TableCell>
</TableRow>
))}
</TableBody>
Expand Down Expand Up @@ -214,7 +221,7 @@ export const EntityInputs: React.FC<{
{fixedInputs.map(({ name, defaultValue }) => (
<TableRow key={name}>
<TableCell>{name}</TableCell>
<TableCell>{defaultValue || '-'}</TableCell>
<TableCell>{coerceDefaultValue(defaultValue) || '-'}</TableCell>
</TableRow>
))}
</TableBody>
Expand Down

0 comments on commit 7e3c6db

Please sign in to comment.