Releases: JedWatson/react-select
react-select@4.0.2
Patch Changes
- 44f285b0 #4399 Thanks @Methuselah96! - Fixed building focusable options from groups
react-select@4.0.1
Patch Changes
- 645feb3e #4396 Thanks @Methuselah96! - Fixed keys for options within groups
react-select@4.0.0
Upgrade Guide
Summary
- Standardize value passed to
onChange
(#4339) - theonChange
handler is now always passed an array of options ifisMulti
is set totrue
- Emotion 11 (#4283) - should only affect you if you're using the
NonceProvider
component - Remove usage of UNSAFE React methods (#4313) - shouldn't affect you except now you won't see those warning messages in the console anymore
Details
Standardize value passed to onChange
This change makes it so that the first parameter passed to the onChange
callback will now always be an array of options if isMulti
is set to true
and will always be a single option or null
if isMulti
is set to false
. Previously the first parameter of onChange
could be an array or null
when isMulti
was set to true
.
That means if you were previously using nullish coalescing in order to handle null
for isMulti
:
<Select
isMulti
onChange={(newValues) => setValues(newValues ?? [])}
/>
You can now remove the nullish coalescing because onChange
will always be an array when isMulti
is set to true
:
<Select
isMulti
onChange={(newValues) => setValues(newValues)}
/>
Emotion 11
The NonceProvider
component now requires a cacheKey
prop that corresponds to the newly required key
prop for the Emotion cache. This won't affect you if you aren't using NonceProvider
. See #4283 for more details.
Remove usage of UNSAFE React methods
This isn't necessarily a breaking change, but it required a large refactor in order to accomplish so we released this in a major upgrade in case it has some unintended consequences.
Changelog
Major Changes
-
02050675 #4339 Thanks @Methuselah96! - Standardized value passed to onChange
-
26b6325c #4283 Thanks @majgaard! - Upgrades Emotion dependency to v11.0.0
BREAKING CHANGE: The NonceProvider component now requires a
cacheKey
prop that corresponds to thekey
for the Emotion cache. -
b2488bb5 #4313 Thanks @Methuselah96! - Removed usages of UNSAFE React methods
Patch Changes
- 2d5496d5 #4388 Thanks @Methuselah96! - Removed memoization of buildMenuOptions
react-select@3.2.0
Minor Changes
-
c615e93d #4084 Thanks @JedWatson! - Changed the
cx
andgetValue
props that are passed to components into instance properties, which means they now pass a referential equality check on subsequent renders.This is helpful, for example, when you're optimising the performance of rendering custom Option components - see #3055
-
72f6036f #4306 Thanks @bladey! - Remove duplicate prop createOptionPosition
Patch Changes
-
ee638d46 #4275 Thanks @Methuselah96! - Adds react ^17.0.0 to peer dependencies for React 17 support
-
a0133f19 #4154 Thanks @brenshanny! - Creatable: Fixed removing MultiValues that have identical values. See issue #4137 for details.
-
d1e660c6 #4213 Thanks @eythort! - Added a guard to the
ScrollCaptor
component to check thatel
exists before callingremoveEventListener
, fixes intermittent errors -
a1e1db25 #4373 Thanks @Methuselah96! - Fixed value passed to onChange when clearing value
-
2ad29d61 #4136 Thanks @Methuselah96! - Base aria-live message on tabSelectsValue prop
-
ad890f27 #4326 Thanks @Methuselah96! - Updated react-input-autosize to v3.0.0
-
b28d9922 #3990 Thanks @nikitaindik! - Fixed onCreateOption is not always called for Creatable
-
24ba8702 #4289 Thanks @slimklim! - Added
innerProps
prop to the built-inMenuList
component to reduce the need for additional DOM nodes or forking internal code when passing additional props to the DOM element the MenuList component is rendering.See issue #4265 for an explanation.
react-select@3.1.1
Patch Changes
-
c8d74bd5 #3979 Thanks @mitchellhamilton! - Fix repository field
-
c8447f48 #4034 Thanks @sophiebits! - Improve performance of option filtering when ignoreAccents is enabled (the default)
-
7af1aafb #4295 Thanks @JedWatson! - Fix menuplacement context
-
32ad5c04 #3892 Thanks @flexdinesh! - Fix react-select ignoring HTML5 "form" attribute
-
6af14fbb #3897 Thanks @lorisdev! - Removes the call to
onMenuOpen
on every input changeIf you were relying on this undesired behavior it may be a breaking change.
Please upgrade accordingly. -
0eb1ef96 Thanks @JedWatson! - Fixes touch issues in IE11
-
ad608c8f #3928 Thanks @dpordomingo! - Update MenuPlacer context usage in order to the new React Context API
react-select@3.1.0
Minor Changes
- 4cf6c43c #3690 Thanks @JedWatson! - Add
isLoading
prop support to the AsyncSelect component (see #3690)
Patch Changes
- 83b48de4 #3868 Thanks @Tirzono! - Fix for not focusing the selected value when the menu opens
- 563b046a #3794 Thanks @mitchellhamilton! - Convert class components that don't have to be class components to function components to reduce bundle size
- c7e9c697 #3682 Thanks @JedWatson! - Allow the input component to be a
textarea
element - 3c7de0de #3090 Thanks @akiselev! - Add aria attributes to dummy input
- d2a820ef #3537 Thanks @jdelStrother! - Fix Flow issues. Refer to the linked PR for more details on the specific issues.
- fc52085b #3662 Thanks @eemeli! - Update react-transition-group to ^4.3.0
- edb18dd3 #3797 Thanks @mitchellhamilton! - Enable Babel loose mode to improve bundle size
react-select@3.0.8
Patch Changes
- a575a3c4 #3727 Thanks @tonytangau! - Adding an
index
prop toMultiValue
components - 916f0d2c #3644 Thanks @TrySound! - Remove usage of
raf
package and replace withwindow.requestAnimationFrame
because React already depends onrequestAnimationFrame
- cba15309 #3676 Thanks @wiesys! - Fix
loadingMessage
andnoOptionsMessage
properties inStyles
flow type - 32f9475e #3790 Thanks @JedWatson! - Remove unnecessary dependency on
classnames
package - 1731175d #3733 Thanks @ddc67cd! - Pass
name
toonChange
meta inCreatable
to make it consistent with onChange in standardSelect
v3.0.3
The core motivation behind 3.0.0 is to set us up to leverage new tools to make react-select better. As such we've made the following changes:
Breaking Changes
- Upgrade from Emotion 9 to Emotion 10
- UMD builds deprecated
- Multiple Entrypoints
- React 16.8 required as peer dependencies
- Normalized Values #3416
What this means for you
Emotion 10
Moving to the latest major version of emotion affords us zero-config SSR and enabling easier CSP support. Unfortunately this will be a breaking change for consumers who are currently leveraging emotion to build custom components for react-select. For example, you'd previously create an custom Option component with emotion like so:
import { css } from 'emotion'
const customOption = ({ cx, className, getStyles, _ }) =>
<div
classNames={cx(
css(getStyles('option', props)),
{
'option': true,
'option--is-disabled': isDisabled,
'option--is-focused': isFocused,
'option--is-selected': isSelected,
},
className
)}
{...}
>
With react-select 3.0.0, and emotion 10 it would be the following:
/** @jsx jsx */
import { jsx } from '@emotion/core';
const customOption = ({ cx, className, getStyles, _ }) =>
<div
css={getStyles('option', props)}
classNames={cx(
{
'option': true,
'option--is-disabled': isDisabled,
'option--is-focused': isFocused,
'option--is-selected': isSelected,
},
className
)}
{...}
>
Multiple Entrypoints:
v3.0.0 separates removes the following components from the main entry point, and instead exports them as separate entrypoints:
- Async (now exported from react-select/async)
- Creatable (now exported from react-select/creatable)
- Async Creatable (now exported from react-select/async-creatable)
- makeAnimated and default animated components (now exported from react-select/animated)
Where you’d previously import them as such
import { Async } from 'react-select'
Or as:
import Async from 'react-select/lib/Async'
Now imports look like this:
import AsyncSelect from 'react-select/async'
This should have no bundle-size impact on react-select consumers currently leveraging tree-shaking. However for consumers who aren’t leveraging tree-shaking, this should help alleviate some of the bundle-weight.
UMD Builds
UMD builds have been removed as of react-select v3.
Peer dependency on React 16.8
We've decided on requiring 16.8 as a peer dependency for react-select 3.0.0. This is motivated by our commitment to leveraging the improvements in recent versions of React such as hooks to make react-select even better.
Normalized Values
At the moment, if no value is specified by the consumer, it's instantiated as a null value, regardless of whether the select isMulti or not.
When isMulti is false this is fine. On selection of an option, the value becomes an object, and on clearing of said value, it returns to being null. (null --> {} --> null)
However when isMulti is true, this becomes more inconsistent. On selection of options, the value becomes an array of options, removing values extricates them from this array, removing the last selected value results in an empty array, instead of the initial base state of null.
(null --> [{}] --> [])
We rectify this in 3.0.0, on removal of all selected values in an isMulti Select, the value passed to onChange is null
and not []
.
- Remove base entrypoint to fix rollup dependency resolution issue in 3.0.3
- See #3585 for a detailed list of changes in 3.0.0
v2.4.2 / 2019-03-11
Bug fixes
- #3446 Fix bug with select input value not being selectable. Thanks @kangweichan
- #3445 Fix accessibility bug. Disabled options are now focusable and announced by screen-readers but not selectable. Thanks @sarahbethfederman
Updates
- Fixed typo in style docs. Thanks thiagodebastos.
- #3460 Added description for actionTypes to docs. Thanks @mikekellyio
v2.4.1 / 2019-02-18
Bug fixes
- #3432 Fix bug with select menu's not working on mobile.