chore(default): avoid crashing
This commit is contained in:
		
							parent
							
								
									3b53d7c623
								
							
						
					
					
						commit
						fa3127e467
					
				| @ -39,6 +39,13 @@ const ToOneNester = (props) => { | |||||||
|   const recordRef = React.useRef(_.omit(record, '__parent')); |   const recordRef = React.useRef(_.omit(record, '__parent')); | ||||||
| 
 | 
 | ||||||
|   const isAllowToSetDefaultValue = useCallback(({ form, fieldSchema, collectionField, getInterface }) => { |   const isAllowToSetDefaultValue = useCallback(({ form, fieldSchema, collectionField, getInterface }) => { | ||||||
|  |     if (!collectionField) { | ||||||
|  |       if (process.env.NODE_ENV !== 'production') { | ||||||
|  |         console.error(`collectionField should not be ${collectionField}`); | ||||||
|  |       } | ||||||
|  |       return false; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     // 当 Field component 不是下列组件时,不允许设置默认值
 |     // 当 Field component 不是下列组件时,不允许设置默认值
 | ||||||
|     if ( |     if ( | ||||||
|       collectionField.target && |       collectionField.target && | ||||||
| @ -85,6 +92,13 @@ const ToManyNester = observer( | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const isAllowToSetDefaultValue = useCallback(({ form, fieldSchema, collectionField, getInterface }) => { |     const isAllowToSetDefaultValue = useCallback(({ form, fieldSchema, collectionField, getInterface }) => { | ||||||
|  |       if (!collectionField) { | ||||||
|  |         if (process.env.NODE_ENV !== 'production') { | ||||||
|  |           console.error(`collectionField should not be ${collectionField}`); | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|       // 当 Field component 不是下列组件时,不允许设置默认值
 |       // 当 Field component 不是下列组件时,不允许设置默认值
 | ||||||
|       if ( |       if ( | ||||||
|         collectionField.target && |         collectionField.target && | ||||||
|  | |||||||
| @ -98,6 +98,13 @@ function _isAllowToSetDefaultValue({ | |||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   if (!collectionField) { | ||||||
|  |     if (process.env.NODE_ENV !== 'production') { | ||||||
|  |       console.error(`collectionField should not be ${collectionField}`); | ||||||
|  |     } | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   // 当 Field component 不是下列组件时,不允许设置默认值
 |   // 当 Field component 不是下列组件时,不允许设置默认值
 | ||||||
|   if ( |   if ( | ||||||
|     collectionField.target && |     collectionField.target && | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user