File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ export type ApolloFormProps<T> = {
5454 subTitle ?: string ;
5555 config : ApolloFormConfig & { mutation ?: { name : T } } ;
5656 onSave ?: ( data : object ) => void ;
57+ onChange ?: ( data : object ) => void ;
5758 onCancel ?: ( ) => void ;
5859 ui ?: UiSchema & ApolloFormUi ;
5960 children ?: React . SFC < ApolloRenderProps > ;
@@ -252,13 +253,20 @@ export function configure<MutationNamesType = {}>(opts: ApolloFormConfigureOptio
252253 this . props . ui ,
253254 data . formData
254255 ) ;
255- this . setState ( ( ) => ( {
256- isDirty : true ,
257- data : cleanData ( data . formData , newSchema . properties ) ,
258- schemaWithConditionals : newSchema ,
259- hasError : data . errors . length > 0 ,
260- isSaved : false
261- } ) ) ;
256+ this . setState (
257+ ( ) => ( {
258+ isDirty : true ,
259+ data : cleanData ( data . formData , newSchema . properties ) ,
260+ schemaWithConditionals : newSchema ,
261+ hasError : data . errors . length > 0 ,
262+ isSaved : false
263+ } ) ,
264+ ( ) => {
265+ if ( this . props . onChange ) {
266+ this . props . onChange ( this . state . data ) ;
267+ }
268+ }
269+ ) ;
262270 }
263271
264272 simulateSubmit = ( ) => {
You can’t perform that action at this time.
0 commit comments