File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
src/controls/modernTaxonomyPicker Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export interface IModernTaxonomyPickerProps {
68
68
export function ModernTaxonomyPicker ( props : IModernTaxonomyPickerProps ) {
69
69
const taxonomyService = new SPTaxonomyService ( props . context ) ;
70
70
const [ panelIsOpen , setPanelIsOpen ] = React . useState ( false ) ;
71
+ const initialLoadComplete = React . useRef ( false ) ;
71
72
const [ selectedOptions , setSelectedOptions ] = React . useState < ITermInfo [ ] > ( [ ] ) ;
72
73
const [ selectedPanelOptions , setSelectedPanelOptions ] = React . useState < ITermInfo [ ] > ( [ ] ) ;
73
74
const [ currentTermStoreInfo , setCurrentTermStoreInfo ] = React . useState < ITermStoreInfo > ( ) ;
@@ -87,6 +88,7 @@ export function ModernTaxonomyPicker(props: IModernTaxonomyPickerProps) {
87
88
setSelectedOptions ( Array . isArray ( props . initialValues ) ?
88
89
props . initialValues . map ( term => { return { ...term , languageTag : languageTag , termStoreInfo : termStoreInfo } as ITermInfo ; } ) :
89
90
[ ] ) ;
91
+ initialLoadComplete . current = true ;
90
92
} ) ;
91
93
taxonomyService . getTermSetInfo ( Guid . parse ( props . termSetId ) )
92
94
. then ( ( termSetInfo ) => {
@@ -101,7 +103,7 @@ export function ModernTaxonomyPicker(props: IModernTaxonomyPickerProps) {
101
103
} , [ ] ) ;
102
104
103
105
React . useEffect ( ( ) => {
104
- if ( props . onChange ) {
106
+ if ( props . onChange && initialLoadComplete . current ) {
105
107
props . onChange ( selectedOptions ) ;
106
108
}
107
109
} , [ selectedOptions ] ) ;
You can’t perform that action at this time.
0 commit comments