diff --git a/ui/src/flux/components/BodyBuilder.tsx b/ui/src/flux/components/BodyBuilder.tsx index 436dac5356..9e50b1afc8 100644 --- a/ui/src/flux/components/BodyBuilder.tsx +++ b/ui/src/flux/components/BodyBuilder.tsx @@ -26,13 +26,10 @@ class BodyBuilder extends PureComponent { const bodybuilder = body.map((b, i) => { if (b.declarations.length) { - return b.declarations.map((d, dIndex) => { + return b.declarations.map(d => { if (d.funcs) { return (
- {!dIndex && ( - - )} { funcs={d.funcs} declarationsFromBody={this.declarationsFromBody} isLastBody={this.isLastBody(i)} + onDeleteBody={onDeleteBody} />
) @@ -65,13 +63,13 @@ class BodyBuilder extends PureComponent { return (
-
) diff --git a/ui/src/flux/components/ExpressionNode.tsx b/ui/src/flux/components/ExpressionNode.tsx index b70d4f4aaf..8275fd6cf7 100644 --- a/ui/src/flux/components/ExpressionNode.tsx +++ b/ui/src/flux/components/ExpressionNode.tsx @@ -15,6 +15,7 @@ interface Props { declarationID?: string declarationsFromBody: string[] isLastBody: boolean + onDeleteBody: (bodyID: string) => void } interface State { @@ -42,6 +43,7 @@ class ExpressionNode extends PureComponent { funcNames, funcs, declarationsFromBody, + onDeleteBody, } = this.props const {nonYieldableIndexesToggled} = this.state @@ -106,6 +108,7 @@ class ExpressionNode extends PureComponent { onGenerateScript={onGenerateScript} declarationsFromBody={declarationsFromBody} onToggleYieldWithLast={this.handleToggleYieldWithLast} + onDeleteBody={onDeleteBody} /> ) @@ -152,6 +155,7 @@ class ExpressionNode extends PureComponent { onGenerateScript={onGenerateScript} declarationsFromBody={declarationsFromBody} onToggleYieldWithLast={this.handleToggleYieldWithLast} + onDeleteBody={onDeleteBody} /> void } interface State { @@ -138,19 +139,10 @@ export default class FuncNode extends PureComponent { } private get deleteButton(): JSX.Element { - const {name} = this.props.func + const {func, bodyID, onDeleteBody} = this.props - if (name === 'from') { - return ( - - ) + if (func.name === 'from') { + return } return (