Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[Select] Null value not working #23558
Comments
|
@radzk the value can't be diff --git a/packages/material-ui/src/Select/Select.d.ts b/packages/material-ui/src/Select/Select.d.ts
index 36819277b5..16db364bf3 100644
--- a/packages/material-ui/src/Select/Select.d.ts
+++ b/packages/material-ui/src/Select/Select.d.ts
@@ -149,7 +149,6 @@ export interface SelectProps<T = unknown>
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
/**
* The `input` value. Providing an empty string will select no options.
- * This prop is required when the `native` prop is `false` (default).
* Set to an empty string `''` if you don't want any of the available options to be selected.
*
* If the value is an object it must have reference equality with the option in order to be selected. |
|
@oliviertassinari I'm not sure about this removed line, I don't think it has anything to do with my problem. I'm referring more to the next line: "Set to an empty string Anyway I found a workaround for my case for now, just switching null to 'all' and vice-versa, like below..
|


https://material-ui.com/api/select/
The docs says that you cannot use empty string value for value field. As long as this is eventually acceptable, there is an issue, because for some reason null value also does not work. These both totally break my communication with backend service, because it seems I'll have to find and replace the values before saving (I do want to save null).
If I change the nulls to any non-empty string, it works, but it isnt a solution.
const options = [{ name: 'Default', value: null }, { name: 'Alternative', value: 'alternative' }]; const currentValue = null;