-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
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:
- 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.
- Build "lib" when publishing, but ignore in repo (same point as above)
- Reduce/reconsider usage of
componentWillMount
? It's triggered on the server, so callingautoloadAsyncOptions
and such here seems strange. Also, I'm not surethis._bindCloseMenuIfClickedOutside = ...
etc are assigned in this way here? - Enforce
"options"
prop to be immutable. Whenever a prop changes, there's twoJSON.stringify
calls incomponentWillReceiveProps
that are expensive for large datasets. It'd be more efficient if there could just be a strict equality check here. - Move functionality not directly related to the control out to separate files/modules. The includes:
- Consolidate menu opening code to happen in one spot. As it is right now, the menu's 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. - Don't modify state directly (esp in render methods). e.g. L630-L634
- Use
...spread
in cases like these. - Why does the
this
context matter on callbacks? E.g.callback.call(this, {});
All React element methods are auto-bound already. - Consider Allow any type in value #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.
@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.
Metadata
Metadata
Assignees
Labels
No labels