Skip to content
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

Minor flow issue in 3.1.0 update #4176

Closed
vikalp-sajwan opened this issue Aug 24, 2020 · 3 comments
Closed

Minor flow issue in 3.1.0 update #4176

vikalp-sajwan opened this issue Aug 24, 2020 · 3 comments
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet issue/reviewed Issue has recently been reviewed (mid-2020)

Comments

@vikalp-sajwan
Copy link

First and foremost, thanks to all the people who are involved in this awesome project.

Are you reporting a bug or runtime error?

Setup up issue.
This is a flow error issue when using Async Select component. This was introduced in #3690 with changes in isLoading prop.
Can't reproduce in sandbox as this is related to setup.

Reproduction steps

The reproduction code is just the fork of this repository with a single component file using the Async Select.
https://github.com/vikalp-sajwan/react-select/blob/master/packages/react-select/src/Async-flow-test-component.js

Issue

➜  react-select git:(flow-issue) ✗ yarn flow check
yarn run v1.22.4
$ /home/code/react-select/node_modules/.bin/flow check
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ packages/react-select/src/Async-flow-test-component.js:38:10

Cannot create AsyncSelect element because undefined [1] is incompatible with boolean [2] in property isLoading.

     packages/react-select/src/Async-flow-test-component.js
      35│     return (
      36│       <div>
      37│         <pre>inputValue: "{this.state.inputValue}"</pre>
      38│         <AsyncSelect
      39│           cacheOptions
      40│           loadOptions={loadOptions}
      41│           defaultOptions
      42│           onInputChange={() => this.handleInputChange('green')}
      43│           isLoading
      44│         />
      45│       </div>
      46│     );
      47│   }

     packages/react-select/src/Async.js
 [2]  34│   isLoading: boolean,

     packages/react-select/src/Select.js
 [1] 160│   isLoading: boolean,



Found 1 error

Issue Cause

Not sure, but seems the defaultProps value defined in Select.js is making it interpret as optional prop, which in turn means it could be undefined, causing the issue.

Possible Solution

Making the isLoading prop optional is fixing the issue.

Are you making a feature request?

No

@bladey bladey added issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet issue/reviewed Issue has recently been reviewed (mid-2020) labels Aug 24, 2020
@ebonow
Copy link
Collaborator

ebonow commented Feb 7, 2021

Greetings @vikalp-sajwan,

To avoid confusion I have removed my prior comments as I mistook the implementation at a quick first glance as object props and not JSX props. I will reopen to further investigate.

@ebonow ebonow closed this as completed Feb 7, 2021
@ebonow ebonow reopened this Feb 7, 2021
@ebonow
Copy link
Collaborator

ebonow commented Feb 9, 2021

@Methuselah96 can you confirm if this is still an issue or not. I tested this in master and wasn't able to replicate. It seems you had been discussing this issue in another thread so wanted to verify.

@Methuselah96
Copy link
Collaborator

Yeah, not sure, but the Flow types should no longer be relevant with the conversion to TypeScript (#4489).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet issue/reviewed Issue has recently been reviewed (mid-2020)
Projects
None yet
Development

No branches or pull requests

4 participants