-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown: Receive Warning even requested props are given #1874
Comments
Same problem |
I can't reproduce this with latest version, please provide versions of React and SUIR. Also, please make a codepen that illustrates an issue, but keep in mind that you will don't recieve warnings there because we're using there production versions. |
Versions are: Weird, neither I can reproduce the error now. @jecacs do you still have the same warning? I know we don't receive warnings when we use production version but that doesn't mean there are no warnings in the system, that's why we work on dev servers, to resolve warns and errs. |
I found the problem. I was making async request in my componentWillMount lifecycle method. I was updating the state, and then using that state variable in my dropdown list. The problem was produced because dropdown was rendered first with empty options before axios async request was done. But I was seeing the options anyway because axios returned a response and it was done so fast. So the warning was given for the first render in which the options variable was empty. |
@volaka: I confirm it's the same in my case, but how to prevent it, any idea? When I set selection='' or anything similar it still throws an error. What is the default value for this property when options are empty? |
@gregiolo I am using redux, now <Dropdown
selection
options={worldOptions}
...
/> so when it renders worldOptions before async call, it renders an empty array, that means empty dropdown. I hope it helps. |
@gregiolo if you want to know what the default prop and type for any prop on a SUIR component is, take a look at the docs at the top of the page for the component you are working with. If it has a default, it's defined in the Default column. https://react.semantic-ui.com/modules/dropdown |
My easy way was doing like this |
Steps to Reproduce
Expected
The Dropdown shouldn't give any warnings.
Result
Dropdown works fine. Can do a search and select an option.
But it logs in console:
Warning: Failed prop type:
selection
prop inDropdown
requires props:options
.Testcase
If the docs show the issue, use: https://react.semantic-ui.com/modules/dropdown#dropdown-example-search-selection-two
The text was updated successfully, but these errors were encountered: