Suppress the material UI Select component out of range error
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Summary 💡
When creating a Select field that is managed and the values are not yet loaded, the following error pops up:
Material-UI: You have provided an out-of-range value `NL` for the select component.
Consider providing a value that matches one of the available options or ''.
The available values are "".
This error is hard to get rid of and should be able to be suppressed?
While the error could be prevented by not showing the Select component while anything is still loading. This kind of beats the idea of modern web pages, to show data as soon as possible.
For example, a user page can show the current selected country, while still loading the list of countries.
The error should be suppressible/ignorable as not to clutter the log with long error message.
Examples 🌈
export const ChangeCountryView = function ChangeCountryView(props:) {
const {user} = props
const [mainList, setMainList] = React.useState<string[]>([]);
React.useEffect(() => {
someLoader.loadCountryListFromServer().then((loadedList) => {
setMainList(loadedList);
});
}, []);
return <Select value={user.country}>{
Array.from(mainList, (v) => {
return <MenuItem key={v} value={v}>{v}</MenuItem>
});
}</Select>
}
Motivation 🔦
To enable progressive loaded pages this would really help, while actually improving the tools to bug fix actual bugs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Select component and reproduce the out-of-range warning with a controlled value whose options load asynchronously. Determine how the warning can be suppressed or ignored, then verify that the warning remains available for actual invalid values and that the documented example behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100