Skip to content

Commit

Permalink
forward more events
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Nov 10, 2019
1 parent 6c9a852 commit 3e7a6ae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default function useAutocomplete(props) {

const [focused, setFocused] = React.useState(false);

const resetInputValue = useEventCallback(newValue => {
const resetInputValue = useEventCallback((event, newValue) => {
let newInputValue;
if (multiple) {
newInputValue = '';
Expand Down Expand Up @@ -202,12 +202,12 @@ export default function useAutocomplete(props) {
setInputValue(newInputValue);

if (onInputChange) {
onInputChange(null, newInputValue);
onInputChange(event, newInputValue);
}
});

React.useEffect(() => {
resetInputValue(value);
resetInputValue(null, value);
}, [value, resetInputValue]);

const { current: isOpenControlled } = React.useRef(openProp != null);
Expand Down Expand Up @@ -413,7 +413,7 @@ export default function useAutocomplete(props) {
handleClose(event);
}

resetInputValue(newValue);
resetInputValue(event, newValue);

selectedIndexRef.current = -1;
};
Expand Down Expand Up @@ -599,7 +599,7 @@ export default function useAutocomplete(props) {
if (autoSelect && selectedIndexRef.current !== -1) {
handleValue(event, filteredOptions[selectedIndexRef.current]);
} else if (!freeSolo) {
resetInputValue(value);
resetInputValue(event, value);
}

handleClose(event);
Expand Down

0 comments on commit 3e7a6ae

Please sign in to comment.