Skip to content

Commit 5be8a5d

Browse files
committed
#578 - Added extra checks for term selection
1 parent 01af3c9 commit 5be8a5d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/controls/taxonomyPicker/Term.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export default class Term extends React.Component<ITermProps, ITermState> {
7070
return styles.termEnabled;
7171
}
7272

73-
private termActionCallback = (updateAction: UpdateAction): void => {
74-
if (updateAction == null) {
73+
private termActionCallback = (updateAction: UpdateAction | null): void => {
74+
if (!updateAction) {
7575
return;
7676
}
7777

@@ -88,10 +88,13 @@ export default class Term extends React.Component<ITermProps, ITermState> {
8888
disabled: updateAction.value as boolean
8989
});
9090
} else if (updateAction.updateActionType === UpdateType.selectTerm) {
91-
this.setState({
92-
selected: updateAction.value as boolean
93-
});
94-
this.props.changedCallback(this.props.term, updateAction.value as boolean);
91+
// Only select the term when not disabled or hidden
92+
if (!this.state.disabled && !this.state.hidden) {
93+
this.setState({
94+
selected: updateAction.value as boolean
95+
});
96+
this.props.changedCallback(this.props.term, updateAction.value as boolean);
97+
}
9598
} else {
9699
this.props.updateTaxonomyTree();
97100
}

src/controls/taxonomyPicker/termActions/ITermsActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface ITermActionsControlProps {
1717
/**
1818
* Callback after execution term action.
1919
*/
20-
termActionCallback: (updateAction: UpdateAction) => void;
20+
termActionCallback: (updateAction: UpdateAction | null) => void;
2121
}
2222

2323
export interface ITermActionsControlState {
@@ -40,7 +40,7 @@ export interface IConcreteTermActionProps {
4040
term: ITerm;
4141
displayStyle: TermActionsDisplayStyle;
4242
spTermService: SPTermStorePickerService;
43-
termActionCallback: (updateAction: UpdateAction) => void;
43+
termActionCallback: (updateAction: UpdateAction | null) => void;
4444
}
4545

4646
/**

0 commit comments

Comments
 (0)