@atlaskit/select
Advanced tools
Comparing version 4.4.0 to 4.5.0
# @atlaskit/select | ||
## 4.5.0 | ||
- [minor] atlaskit/select now invokes a makeAnimated function to wrap passed in components in default animated behaviour. As this invocation returns a new set of react components each time, we've also implemented a lightweight component cache using memoize-one and react-fast-compare. Additionally updates made to datetime-picker to not instantiate a new component on render everytime (for performance reasons as well as to satisfy our caching logic), we now also pass relevant state values through the select as props to be ingested by our custom components, instead of directly capturing them within lexical scope. [9b01264](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9b01264) | ||
- [none] Updated dependencies [9b01264](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9b01264) | ||
## 4.4.0 | ||
@@ -4,0 +8,0 @@ - [minor] Added nav-next "Switcher" component. Minor fixes and dep bump for select. [ed5d8d1](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/ed5d8d1) |
@@ -43,8 +43,12 @@ 'use strict'; | ||
var _theme = require('@atlaskit/theme'); | ||
var _memoizeOne = require('memoize-one'); | ||
var _animated = require('react-select/lib/animated'); | ||
var _memoizeOne2 = _interopRequireDefault(_memoizeOne); | ||
var animatedComponents = _interopRequireWildcard(_animated); | ||
var _reactFastCompare = require('react-fast-compare'); | ||
var _reactFastCompare2 = _interopRequireDefault(_reactFastCompare); | ||
var _theme = require('@atlaskit/theme'); | ||
var _components = require('./components'); | ||
@@ -217,2 +221,3 @@ | ||
} | ||
function createSelect(WrappedComponent) { | ||
@@ -230,3 +235,3 @@ var _class, _temp; | ||
_this.cacheComponents = function (components) { | ||
_this.components = (0, _extends3.default)({}, defaultComponents, animatedComponents, components); | ||
_this.components = (0, _reactSelect.makeAnimated)((0, _extends3.default)({}, defaultComponents, components)); | ||
}; | ||
@@ -244,2 +249,3 @@ | ||
_this.cacheComponents = (0, _memoizeOne2.default)(_this.cacheComponents, _reactFastCompare2.default).bind(_this); | ||
_this.cacheComponents(props.components); | ||
@@ -252,5 +258,3 @@ return _this; | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (nextProps.components !== this.props.components) { | ||
this.cacheComponents(nextProps.components); | ||
} | ||
this.cacheComponents(nextProps.components); | ||
} | ||
@@ -257,0 +261,0 @@ }, { |
@@ -9,6 +9,7 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; | ||
import React, { Component } from 'react'; | ||
import { mergeStyles } from 'react-select'; | ||
import { mergeStyles, makeAnimated } from 'react-select'; | ||
import memoizeOne from 'memoize-one'; | ||
import isEqual from 'react-fast-compare'; | ||
import { colors, gridSize } from '@atlaskit/theme'; | ||
import * as animatedComponents from 'react-select/lib/animated'; | ||
import * as defaultComponents from './components'; | ||
@@ -188,3 +189,3 @@ | ||
_this.cacheComponents = function (components) { | ||
_this.components = _extends({}, defaultComponents, animatedComponents, components); | ||
_this.components = makeAnimated(_extends({}, defaultComponents, components)); | ||
}; | ||
@@ -202,2 +203,3 @@ | ||
_this.cacheComponents = memoizeOne(_this.cacheComponents, isEqual).bind(_this); | ||
_this.cacheComponents(props.components); | ||
@@ -210,5 +212,3 @@ return _this; | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (nextProps.components !== this.props.components) { | ||
this.cacheComponents(nextProps.components); | ||
} | ||
this.cacheComponents(nextProps.components); | ||
} | ||
@@ -215,0 +215,0 @@ }, { |
{ | ||
"name": "@atlaskit/select", | ||
"version": "4.3.6" | ||
"version": "4.4.0" | ||
} |
{ | ||
"name": "@atlaskit/select", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"description": "React component which allows selection of item(s) from a dropdown list.", | ||
@@ -30,2 +30,4 @@ "license": "Apache-2.0", | ||
"focus-trap": "^2.4.5", | ||
"memoize-one": "^3.0.1", | ||
"react-fast-compare": "^2.0.1", | ||
"react-node-resolver": "^1.0.1", | ||
@@ -32,0 +34,0 @@ "react-popper": "^1.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
226495
2369
12
+ Addedmemoize-one@^3.0.1
+ Addedreact-fast-compare@^2.0.1
+ Addedmemoize-one@3.1.1(transitive)
+ Addedreact-fast-compare@2.0.4(transitive)