Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-select-async-paginate

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-select-async-paginate - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

es/styles/index.js

61

es/index.js

@@ -15,3 +15,5 @@ import _extends from "@babel/runtime/helpers/extends";

import { SelectBase } from 'react-select';
import mergeStyles from './styles';
var initialCache = {
isFirstLoad: true,
options: [],

@@ -147,2 +149,3 @@ hasMore: true,

'': {
isFirstLoad: false,
isLoading: false,

@@ -178,3 +181,3 @@ options: props.options,

_regeneratorRuntime.mark(function _callee4() {
var _this$state2, search, optionsCache, currentOptions, _loadOptions2, _ref4, options, hasMore;
var _this$state2, search, optionsCache, currentOptions, hasError, options, hasMore, _loadOptions2, response;

@@ -213,11 +216,24 @@ return _regeneratorRuntime.wrap(function _callee4$(_context4) {

case 10:
_ref4 = _context4.sent;
options = _ref4.options;
hasMore = _ref4.hasMore;
_context4.next = 15;
response = _context4.sent;
options = response.options;
hasMore = response.hasMore;
hasError = false;
_context4.next = 19;
break;
case 16:
_context4.prev = 16;
_context4.t0 = _context4["catch"](6);
hasError = true;
case 19:
if (!hasError) {
_context4.next = 24;
break;
}
_context4.next = 22;
return this.setState(function (prevState) {
return {
optionsCache: _objectSpread({}, prevState.optionsCache, _defineProperty({}, search, _objectSpread({}, currentOptions, {
options: currentOptions.options.concat(options),
hasMore: !!hasMore,
isLoading: false

@@ -228,14 +244,15 @@ })))

case 15:
_context4.next = 21;
case 22:
_context4.next = 26;
break;
case 17:
_context4.prev = 17;
_context4.t0 = _context4["catch"](6);
_context4.next = 21;
case 24:
_context4.next = 26;
return this.setState(function (prevState) {
return {
optionsCache: _objectSpread({}, prevState.optionsCache, _defineProperty({}, search, _objectSpread({}, currentOptions, {
isLoading: false
options: currentOptions.options.concat(options),
hasMore: !!hasMore,
isLoading: false,
isFirstLoad: false
})))

@@ -245,3 +262,3 @@ };

case 21:
case 26:
case "end":

@@ -251,3 +268,3 @@ return _context4.stop();

}
}, _callee4, this, [[6, 17]]);
}, _callee4, this, [[6, 16]]);
}));

@@ -264,3 +281,5 @@

value: function render() {
var selectRef = this.props.selectRef;
var _this$props = this.props,
selectRef = _this$props.selectRef,
styles = _this$props.styles;
var _this$state3 = this.state,

@@ -279,3 +298,5 @@ search = _this$state3.search,

isLoading: currentOptions.isLoading,
isFirstLoad: currentOptions.isFirstLoad,
options: currentOptions.options,
styles: mergeStyles(styles),
ref: selectRef

@@ -294,3 +315,4 @@ }));

selectRef: PropTypes.func,
options: PropTypes.arrayOf(PropTypes.object)
options: PropTypes.arrayOf(PropTypes.object),
styles: PropTypes.objectOf(PropTypes.func)
});

@@ -301,5 +323,6 @@

selectRef: function selectRef() {},
options: null
options: null,
styles: {}
});
export default AsyncPaginate;

@@ -40,3 +40,6 @@ "use strict";

var _styles = _interopRequireDefault(require("./styles"));
var initialCache = {
isFirstLoad: true,
options: [],

@@ -166,2 +169,3 @@ hasMore: true,

'': {
isFirstLoad: false,
isLoading: false,

@@ -197,3 +201,3 @@ options: props.options,

_regenerator.default.mark(function _callee4() {
var _this$state2, search, optionsCache, currentOptions, _loadOptions2, _ref4, options, hasMore;
var _this$state2, search, optionsCache, currentOptions, hasError, options, hasMore, _loadOptions2, response;

@@ -232,11 +236,24 @@ return _regenerator.default.wrap(function _callee4$(_context4) {

case 10:
_ref4 = _context4.sent;
options = _ref4.options;
hasMore = _ref4.hasMore;
_context4.next = 15;
response = _context4.sent;
options = response.options;
hasMore = response.hasMore;
hasError = false;
_context4.next = 19;
break;
case 16:
_context4.prev = 16;
_context4.t0 = _context4["catch"](6);
hasError = true;
case 19:
if (!hasError) {
_context4.next = 24;
break;
}
_context4.next = 22;
return this.setState(function (prevState) {
return {
optionsCache: (0, _objectSpread5.default)({}, prevState.optionsCache, (0, _defineProperty2.default)({}, search, (0, _objectSpread5.default)({}, currentOptions, {
options: currentOptions.options.concat(options),
hasMore: !!hasMore,
isLoading: false

@@ -247,14 +264,15 @@ })))

case 15:
_context4.next = 21;
case 22:
_context4.next = 26;
break;
case 17:
_context4.prev = 17;
_context4.t0 = _context4["catch"](6);
_context4.next = 21;
case 24:
_context4.next = 26;
return this.setState(function (prevState) {
return {
optionsCache: (0, _objectSpread5.default)({}, prevState.optionsCache, (0, _defineProperty2.default)({}, search, (0, _objectSpread5.default)({}, currentOptions, {
isLoading: false
options: currentOptions.options.concat(options),
hasMore: !!hasMore,
isLoading: false,
isFirstLoad: false
})))

@@ -264,3 +282,3 @@ };

case 21:
case 26:
case "end":

@@ -270,3 +288,3 @@ return _context4.stop();

}
}, _callee4, this, [[6, 17]]);
}, _callee4, this, [[6, 16]]);
}));

@@ -283,3 +301,5 @@

value: function render() {
var selectRef = this.props.selectRef;
var _this$props = this.props,
selectRef = _this$props.selectRef,
styles = _this$props.styles;
var _this$state3 = this.state,

@@ -298,3 +318,5 @@ search = _this$state3.search,

isLoading: currentOptions.isLoading,
isFirstLoad: currentOptions.isFirstLoad,
options: currentOptions.options,
styles: (0, _styles.default)(styles),
ref: selectRef

@@ -312,3 +334,4 @@ }));

selectRef: _propTypes.default.func,
options: _propTypes.default.arrayOf(_propTypes.default.object)
options: _propTypes.default.arrayOf(_propTypes.default.object),
styles: _propTypes.default.objectOf(_propTypes.default.func)
});

@@ -318,5 +341,6 @@ (0, _defineProperty2.default)(AsyncPaginate, "defaultProps", {

selectRef: function selectRef() {},
options: null
options: null,
styles: {}
});
var _default = AsyncPaginate;
exports.default = _default;
{
"name": "react-select-async-paginate",
"version": "0.2.2",
"version": "0.2.3",
"description": "Wrapper above react-select that supports pagination on menu scroll",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc