Skip to content

Commit

Permalink
fix(core): disallow transitions to same node (resolve #900) (#962)
Browse files Browse the repository at this point in the history
  • Loading branch information
epaminond committed Oct 1, 2018
1 parent 9b8ee56 commit cdfcd26
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Expand Up @@ -171,8 +171,9 @@ export default class ConditionModalForm extends Component {
}

getNodeOptions() {
const flow = this.props.currentFlow
return (flow && flow.nodes.map(({ name }) => ({ label: name, value: name }))) || []
const { currentFlow: flow, currentNodeName } = this.props
const nodes = (flow && flow.nodes) || []
return nodes.filter(({ name }) => name !== currentNodeName).map(({ name }) => ({ label: name, value: name }))
}

renderNodesChoice() {
Expand Down
Expand Up @@ -92,6 +92,8 @@ export default class StandardNodePropertiesPanel extends Component {
readOnly={readOnly}
items={node.next}
header="Transitions"
currentFlow={this.props.flow}
currentNodeName={node.name}
subflows={this.props.subflows}
onItemsUpdated={items => this.props.updateNode({ next: items })}
copyItem={item => this.props.copyFlowNodeElement({ transition: item })}
Expand Down
Expand Up @@ -112,6 +112,7 @@ export default class TransitionSection extends Component {
{!readOnly && (
<ConditionModalForm
currentFlow={this.props.currentFlow}
currentNodeName={this.props.currentNodeName}
subflows={this.props.subflows}
show={this.state.showConditionalModalForm}
onClose={() => this.setState({ showConditionalModalForm: false, itemToEditIndex: null })}
Expand Down

0 comments on commit cdfcd26

Please sign in to comment.