@@ -5,7 +5,6 @@ import isEqual from 'lodash/isEqual';
5
5
import has from 'lodash/has' ;
6
6
7
7
// Material UI
8
- import { withStyles } from '@mui/styles' ;
9
8
import Typography from '@mui/material/Typography' ;
10
9
import Divider from '@mui/material/Divider' ;
11
10
@@ -32,31 +31,30 @@ export const shouldHideTitle = (uiSchema, schema) => isPageLayoutSet(uiSchema) |
32
31
export const RawFieldSetContent = ( props ) => {
33
32
const { schema = { } , uiSchema = { } , xhrSchema = { } } = props ;
34
33
const { type } = schema ;
34
+ const classes = fieldSetStyles . fieldSetContent ( ) ;
35
35
const SchemaTypeComponents = RENDER_BASED_ON_SCHEMA_TYPE ( {
36
36
schema,
37
37
uiSchema,
38
38
xhrSchema,
39
- props,
39
+ props : { ... props , classes } ,
40
40
} ) ;
41
41
return Utils . callFunctionIfExists ( SchemaTypeComponents , type ) ;
42
42
} ;
43
43
44
- export const FieldSetContent = withStyles ( fieldSetStyles . fieldSetContent ) ( RawFieldSetContent ) ;
44
+ export const FieldSetContent = RawFieldSetContent ;
45
45
46
46
// for unit testing
47
- class RawFieldSet extends React . Component < FieldSetProps , { } > {
48
- shouldComponentUpdate = ( nextProps ) => ! isEqual ( this . props , nextProps )
49
-
50
- render ( ) {
47
+ const RawFieldSet = React . memo (
48
+ ( props : FieldSetProps ) => {
51
49
const {
52
50
className,
53
51
path,
54
- classes,
55
52
schema = { } ,
56
53
hideTitle,
57
54
noTitle,
58
55
validation,
59
- } = this . props ;
56
+ } = props ;
57
+ const classes = fieldSetStyles . fieldSet ( ) ;
60
58
const LegendTitle = ( ) => ( (
61
59
! hideTitle
62
60
|| path === ''
@@ -88,10 +86,9 @@ class RawFieldSet extends React.Component<FieldSetProps, {}> {
88
86
{ ! noTitle && ( < LegendTitle /> ) }
89
87
{ ! noTitle && ( < LegendSubTitle /> ) }
90
88
{ path === '' && < ValidationMessages validation = { validation } /> }
91
- < FieldSetContent path = { path } { ...this . props } />
89
+ < FieldSetContent path = { path } { ...props } />
92
90
</ fieldset >
93
91
) ;
94
- }
95
- }
92
+ } , ( prevProps , nextProps ) => isEqual ( prevProps , nextProps ) ) ;
96
93
97
- export default withStyles ( fieldSetStyles . fieldSet ) ( RawFieldSet ) ;
94
+ export default RawFieldSet ;
0 commit comments