Skip to content

Commit

Permalink
Move onFilled and onEmpty out of shared useMemo
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoAndai committed Oct 16, 2024
1 parent 064fa67 commit 6b32256
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/mui-material/src/FormControl/FormControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ const FormControl = React.forwardRef(function FormControl(inProps, ref) {
};
}

const onFilled = React.useCallback(() => {
setFilled(true);
}, []);

const onEmpty = React.useCallback(() => {
setFilled(false);
}, []);

const childContext = React.useMemo(() => {
return {
adornedStart,
Expand All @@ -206,15 +214,11 @@ const FormControl = React.forwardRef(function FormControl(inProps, ref) {
onBlur: () => {
setFocused(false);
},
onEmpty: () => {
setFilled(false);
},
onFilled: () => {
setFilled(true);
},
onFocus: () => {
setFocused(true);
},
onEmpty,
onFilled,
registerEffect,
required,
variant,
Expand All @@ -229,6 +233,8 @@ const FormControl = React.forwardRef(function FormControl(inProps, ref) {
fullWidth,
hiddenLabel,
registerEffect,
onEmpty,
onFilled,
required,
size,
variant,
Expand Down

0 comments on commit 6b32256

Please sign in to comment.