Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Comment thread
micahgodbolt marked this conversation as resolved.
"type": "minor",
"comment": "Fix: Combobox if value is controlled, we should not update state",
"packageName": "@fluentui/react",
"email": "mgodbolt@microsoft.com",
"dependentChangeType": "patch"
}
8 changes: 6 additions & 2 deletions packages/react/src/components/Autofill/Autofill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,16 @@ export class Autofill extends React.Component<IAutofillProps, IAutofillState> im
}

// eslint-disable-next-line deprecation/deprecation
const { onInputChange, onInputValueChange } = this.props;
const { onInputChange, onInputValueChange, updateValueInWillReceiveProps } = this.props;
if (onInputChange) {
newValue = onInputChange?.(newValue, composing) || '';
}

this.setState({ inputValue: newValue }, () => onInputValueChange?.(newValue, composing));
// if value is controlled, then we should not update the value in state
Comment thread
micahgodbolt marked this conversation as resolved.
Outdated
// https://github.com/microsoft/fluentui/issues/18499
updateValueInWillReceiveProps
? onInputValueChange?.(newValue, composing)
: this.setState({ inputValue: newValue }, () => onInputValueChange?.(newValue, composing));
};

private _getDisplayValue(): string {
Expand Down