@@ -67,16 +67,23 @@ class TalentPickerQuestion extends Component {
6767 } ) )
6868 }
6969
70+ onChange ( value ) {
71+ const { setValue, name} = this . props
72+
73+ setValue ( value )
74+ this . props . onChange ( name , value )
75+ }
76+
7077 handleValueChange ( index , field , value ) {
71- const { getValue, setValue } = this . props
78+ const { getValue } = this . props
7279 let values = getValue ( ) || this . getDefaultValue ( )
7380 values = [ ...values . slice ( 0 , index ) , { ...values [ index ] , [ field ] : value } , ...values . slice ( index + 1 ) ]
7481
75- setValue ( values )
82+ this . onChange ( values )
7683 }
7784
7885 insertRole ( index , role ) {
79- const { getValue, setValue } = this . props
86+ const { getValue } = this . props
8087 let values = getValue ( ) || this . getDefaultValue ( )
8188
8289 values = [
@@ -89,14 +96,14 @@ class TalentPickerQuestion extends Component {
8996 } ,
9097 ...values . slice ( index )
9198 ]
92- setValue ( values )
99+ this . onChange ( values )
93100 }
94101
95102 removeRole ( index ) {
96- const { getValue, setValue } = this . props
103+ const { getValue } = this . props
97104 let values = getValue ( ) || this . getDefaultValue ( )
98105 values = [ ...values . slice ( 0 , index ) , ...values . slice ( index + 1 ) ]
99- setValue ( values )
106+ this . onChange ( values )
100107 }
101108
102109 canDeleteRole ( role , index ) {
@@ -149,8 +156,11 @@ TalentPickerQuestion.PropTypes = {
149156 disabled : PropTypes . bool ,
150157 } )
151158 ) . isRequired ,
159+ onChange : PropTypes . func ,
152160}
153161
154- TalentPickerQuestion . defaultProps = { }
162+ TalentPickerQuestion . defaultProps = {
163+ onChange : _ . noop
164+ }
155165
156166export default hoc ( TalentPickerQuestion )
0 commit comments