{"action":"opened","issue":{"url":"https://api.github.com/repos/JedWatson/react-select/issues/227","labels_url":"https://api.github.com/repos/JedWatson/react-select/issues/227/labels{/name}","comments_url":"https://api.github.com/repos/JedWatson/react-select/issues/227/comments","events_url":"https://api.github.com/repos/JedWatson/react-select/issues/227/events","html_url":"https://github.com/JedWatson/react-select/issues/227","id":83680225,"number":227,"title":"Potential Refactor?","user":{"login":"brianreavis","id":118480,"avatar_url":"https://avatars.githubusercontent.com/u/118480?v=3","gravatar_id":"","url":"https://api.github.com/users/brianreavis","html_url":"https://github.com/brianreavis","followers_url":"https://api.github.com/users/brianreavis/followers","following_url":"https://api.github.com/users/brianreavis/following{/other_user}","gists_url":"https://api.github.com/users/brianreavis/gists{/gist_id}","starred_url":"https://api.github.com/users/brianreavis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianreavis/subscriptions","organizations_url":"https://api.github.com/users/brianreavis/orgs","repos_url":"https://api.github.com/users/brianreavis/repos","events_url":"https://api.github.com/users/brianreavis/events{/privacy}","received_events_url":"https://api.github.com/users/brianreavis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-01T20:32:37Z","updated_at":"2015-06-01T20:32:37Z","closed_at":null,"body":"First, react-select is slick! It's been awesome to work with. I've been wanting to make some bugfixes, but have ended up with my hands tied because of a few things that are hard to reason about. This list also contains some other notes:\r\n\r\n- [ ] Drop the \"dist\" files altogether. React's already basically impossible to use without a bundler, so I'm not sure if it's doing much good? \"Please don't update the dist files\" gets really old to say to the million people who don't read the contributing notes.\r\n- [ ] Build \"lib\" when publishing, but ignore in repo (same point as above)\r\n- [ ] Reduce/reconsider usage of `componentWillMount`? It's triggered on the server, so calling `autoloadAsyncOptions` and such here seems strange. Also, I'm not sure `this._bindCloseMenuIfClickedOutside = ...` etc are assigned in this way here?\r\n- [ ] Enforce `\"options\"` prop to be immutable. Whenever a prop changes, there's two `JSON.stringify` calls in `componentWillReceiveProps` that are expensive for large datasets. It'd be more efficient if there could just be a strict equality check here.\r\n- [ ] Move functionality not directly related to the control out to separate files/modules. The includes:\r\n   - [ ] DOM event binding\r\n   - [ ] Option searching (for [selectize](https://github.com/brianreavis/selectize.js) I split this out to [sifter.js](https://github.com/brianreavis/sifter.js) because it ballooned and needlessly complicated the library)\r\n- [ ] Consolidate menu opening code to happen in one spot. As it is right now, the menu's opened and events are bound multiple places throughout the library. I *think* the intent is to consolidate `setState` calls? React will batch these so I think's a bit moot and leading to more problems than it's solving? It's tough to track down where events are bound/unbound.\r\n- [ ] Don't modify state directly (esp in render methods). e.g. [L630-L634](https://github.com/JedWatson/react-select/blob/master/src/Select.js#L630-L634)\r\n- [ ] Use `...spread` in cases like [these](https://github.com/JedWatson/react-select/blob/master/src/Select.js#L737-L741).\r\n- [ ] Why does the `this` context matter on callbacks? E.g. `callback.call(this, {});` All React element methods are auto-bound already.\r\n- [ ] Consider https://github.com/JedWatson/react-select/issues/25. Given that React's point is abstracting away DOM craziness, I think that the \"values must be strings\" is quite limiting... it leads to lots of application-level casting in `onChange` events. It feels very weird to cast an ID to a string for `<Select>` then cast it back to a number.\r\n\r\n@JedWatson @dcousens What are your thoughts on these? I almost started on a lot of these today, but it'll create a lot of merge conflicts on existing PRs and be a little risky w/o tests."}}