question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The core motivation behind 3.0.0 is to set us up to leverage new tools to make react-select better. We’ve also made some 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 []. normalize-value

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:37
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

63reactions
carlreidcommented, May 27, 2019

Would be awesome if you could update typings for this too. Currently don’t believe I can import like so: import AsyncSelect from 'react-select/async'

image

15reactions
iraSenthilcommented, Jun 24, 2019

Is there anyways we could link this in release notes?

I usually look at release notes to figure out breaking changes before upgrading.

Read more comments on GitHub >

github_iconTop Results From Across the Web

V3 Upgrade Guide | Recurly Developer Hub
V3 Upgrade Guide. The purpose of this document is to provide you with the guidance necessary to upgrade from version 2 to version...
Read more >
Cisco ISE 3.0 Upgrade Guide: Upgrade Method
You can upgrade Cisco ISE using GUI, Backup and Restore, or CLI. In case you are using GUI to upgrade you can choose...
Read more >
Terraform AWS Provider Version 3 Upgrade Guide
Version 3.0.0 of the AWS provider for Terraform is a major release and includes some changes that you will need to consider when...
Read more >
Upgrade Guide - Tailwind CSS
Upgrade Guide. Upgrading your Tailwind CSS projects from v2 to v3. Tailwind CSS v3.0 is a major update to the framework with a...
Read more >
V2 to V3 Upgrade Guide - Micro
Upgrading your project from Go-Micro v2 to Micro v3 ... now deprecated go-micro framework can follow this guide to upgrade their projects to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found