Skip to content
This repository has been archived by the owner on Dec 23, 2022. It is now read-only.

Fix 'required' prop for non-empty chip sets. #315

Merged
merged 2 commits into from
Apr 26, 2020
Merged
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/ChipInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ class ChipInput extends React.Component {
[classes.marginDense]: other.margin === 'dense'
})}
error={error}
required={required}
required={chips.length ? undefined : required}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be changed to chips.length === 0 so that we know what this is intended to do. Let the minifier minify the code.

onClick={this.focus}
disabled={disabled}
variant={variant}
Expand All @@ -590,6 +590,7 @@ class ChipInput extends React.Component {
focused={this.state.isFocused}
variant={variant}
ref={this.labelRef}
required={required}
{...InputLabelProps}
>
{label}
Expand Down