Skip to content

Commit

Permalink
Only validate the new category dialog when enabling the top level toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Copons committed Apr 20, 2018
1 parent 58ce792 commit 5822b64
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions client/blocks/term-form-dialog/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ class TermFormDialog extends Component {
};

onTopLevelChange = () => {
// Only validate the form when **enabling** the top level toggle.
const performValidation = ! this.state.isTopLevel ? this.isValid : noop;
this.setState(
{
isTopLevel: ! this.state.isTopLevel,
( { isTopLevel } ) => ( {
isTopLevel: ! isTopLevel,
selectedParent: [],
},
this.isValid
} ),
performValidation
);
};

Expand Down

0 comments on commit 5822b64

Please sign in to comment.