Skip to content

Commit 4ecf18c

Browse files
pushpinder107danielcaldas
authored andcommitted
Stop node removal when node count reaches 1 (#288)
1 parent a98258a commit 4ecf18c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sandbox/Sandbox.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export default class Sandbox extends React.Component {
163163
* Remove a node.
164164
*/
165165
onClickRemoveNode = () => {
166-
if (this.state.data.nodes && this.state.data.nodes.length) {
166+
if (this.state.data.nodes && this.state.data.nodes.length > 1) {
167167
const id = this.state.data.nodes[0].id;
168168

169169
this.state.data.nodes.splice(0, 1);
@@ -172,7 +172,7 @@ export default class Sandbox extends React.Component {
172172

173173
this.setState({ data });
174174
} else {
175-
toast("No more nodes to remove!");
175+
toast("Need to have at least one node!");
176176
}
177177
};
178178

0 commit comments

Comments
 (0)