Skip to content

Commit 5da2f0d

Browse files
awolokitasdirix
andauthored
Explicitly check for undefined in React Material Select
In MuiSelect the value was set to the empty string when the incoming data was falsy. This lead to problems when for example the number zero is an expected value. We now only check for `undefined` and hand over all other values. Co-authored-by: Stefan Dirix <sdirix@eclipsesource.com>
1 parent ba6bdc5 commit 5da2f0d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/material/src/mui-controls/MuiSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const MuiSelect = React.memo((props: EnumCellProps & WithClassname) => {
5050
id={id}
5151
disabled={!enabled}
5252
autoFocus={appliedUiSchemaOptions.focus}
53-
value={data || ''}
53+
value={data !== undefined ? data : ''}
5454
onChange={ev => handleChange(path, ev.target.value)}
5555
fullWidth={true}
5656
>

0 commit comments

Comments
 (0)