Skip to content

Commit 753bfc2

Browse files
patrikhellgrenAJIXuMuK
authored andcommitted
Fix for ModernTaxonomyPicker infinite loop
1 parent f6fc987 commit 753bfc2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/documentation/docs/controls/ModernTaxonomyPicker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ The ModernTaxonomyPicker control can be configured with the following properties
163163
| label | string | yes | Text displayed above the Taxonomy Picker. |
164164
| disabled | boolean | no | Specify if the control should be disabled. Default value is false. |
165165
| context | BaseComponentContext | yes | Context of the current web part or extension. |
166-
| initialValues | ITermInfo[] | no | Defines the terms selected by default. ITermInfo comes from PnP/PnPjs and can be imported with <br/>```import { ITermInfo } from '@pnp/sp/taxonomy';``` |
166+
| initialValues | ITermInfo[] | no | Defines the terms selected by default. This will only set the initial values and cannot be used to use the control in a controlled way. ITermInfo comes from PnP/PnPjs and can be imported with <br/>```import { ITermInfo } from '@pnp/sp/taxonomy';``` |
167167
| allowMultipleSelections | boolean | no | Defines if the user can select only one or multiple terms. Default value is false. |
168168
| termSetId | string | yes | The Id of the TermSet that you would like the Taxonomy Picker to select terms from. |
169169
| onChange | function | no | Captures the event of when the terms in the picker has changed. |

src/controls/modernTaxonomyPicker/ModernTaxonomyPicker.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ export function ModernTaxonomyPicker(props: IModernTaxonomyPickerProps): JSX.Ele
108108
// no-op;
109109
});
110110
}
111-
}, [currentTermStoreInfo?.defaultLanguageTag, props.anchorTermId, props.context.pageContext, props.initialValues, props.termSetId, taxonomyService]);
111+
}, []);
112112

113113
React.useEffect(() => {
114114
if (props.onChange && initialLoadComplete.current) {
115115
props.onChange(selectedOptions);
116116
}
117-
}, [props, selectedOptions]);
117+
}, [selectedOptions]);
118118

119119
function onOpenPanel(): void {
120120
if (props.disabled === true) {

0 commit comments

Comments
 (0)