File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,10 @@ export default class Form<
319319 if ( ! deepEquals ( this . props , prevProps ) ) {
320320 const formDataChangedFields = getChangedFields ( this . props . formData , prevProps . formData ) ;
321321 const isSchemaChanged = ! deepEquals ( prevProps . schema , this . props . schema ) ;
322- const isFormDataChanged = formDataChangedFields . length > 0 ;
322+ // When formData is not an object, getChangedFields returns an empty array.
323+ // In this case, deepEquals is most needed to check again.
324+ const isFormDataChanged =
325+ formDataChangedFields . length > 0 || ! deepEquals ( prevProps . formData , this . props . formData ) ;
323326 const nextState = this . getStateFromProps (
324327 this . props ,
325328 this . props . formData ,
Original file line number Diff line number Diff line change @@ -4489,8 +4489,8 @@ describe('Form omitExtraData and liveOmit', () => {
44894489 // // error should still be present.
44904490 errors = node . querySelectorAll ( '.error-detail' ) ;
44914491 // screen.debug();
4492- expect ( errors ) . to . have . lengthOf ( 1 ) ;
4493- expect ( errors [ 0 ] . textContent ) . to . be . eql ( "must have required property 'input'" ) ;
4492+ // change formData and make sure the error disappears.
4493+ expect ( errors ) . to . have . lengthOf ( 0 ) ;
44944494
44954495 // trigger programmatic validation again and make sure the error disappears.
44964496 act ( ( ) => {
You can’t perform that action at this time.
0 commit comments