react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Error if `onChange` causes the component to unmount.

Open Xesued opened this issue 10 years ago • 3 comments

If an onChange callback cause the component to unmount, the Select's selectValue tries to setState after, causing a React Error.

Xesued avatar May 20 '16 14:05 Xesued

I believe that swapping the this.setState(...) and this.setValue(value) (https://github.com/JedWatson/react-select/blob/master/src/Select.js#L499) should solve the issue.

Xesued avatar May 20 '16 14:05 Xesued

@Xesued,

Can you provide a reproduction test-case for this problem? I'm having some difficulty reproducing it the error you're describing with 1.0 beta 13 and React 15.

bvaughn avatar May 22 '16 22:05 bvaughn

https://plnkr.co/edit/nXHsCdRyUfxa8OR48bmd?p=info

If you change the results, you will notice an error thrown in the console.

Xesued avatar May 23 '16 01:05 Xesued