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

redux-connect

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-connect - npm Package Compare versions

Comparing version 9.0.0 to 10.0.0

24

es/components/AsyncConnect.js

@@ -7,4 +7,2 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/* eslint-disable react/forbid-prop-types,react/no-unused-prop-types,react/require-default-props */

@@ -46,3 +44,4 @@ import React, { Component } from 'react';

_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
// eslint-disable-line camelcase
var _this$props = this.props,

@@ -122,4 +121,3 @@ location = _this$props.location,

}(Component);
_defineProperty(AsyncConnect, "defaultProps", {
AsyncConnect.defaultProps = {
helpers: {},

@@ -129,11 +127,11 @@ reloadOnPropsChange: function reloadOnPropsChange() {

},
render: function render(_ref4) {
var routes = _ref4.routes;
render: function render(_ref2) {
var routes = _ref2.routes;
return renderRoutes(routes);
}
});
};
var AsyncConnectWithContext = function AsyncConnectWithContext(_ref2) {
var context = _ref2.context,
otherProps = _objectWithoutPropertiesLoose(_ref2, ["context"]);
var AsyncConnectWithContext = function AsyncConnectWithContext(_ref3) {
var context = _ref3.context,
otherProps = _objectWithoutPropertiesLoose(_ref3, ["context"]);

@@ -146,4 +144,4 @@ var Context = context || ReactReduxContext;

return React.createElement(Context.Consumer, null, function (_ref3) {
var reduxConnectStore = _ref3.store;
return React.createElement(Context.Consumer, null, function (_ref4) {
var reduxConnectStore = _ref4.store;
return React.createElement(AsyncConnect, _extends({

@@ -150,0 +148,0 @@ reduxConnectStore: reduxConnectStore

@@ -5,5 +5,5 @@ import { connect } from 'react-redux';

import { beginGlobalLoad, endGlobalLoad } from '../store';
export default withRouter(connect(null, {
export default connect(null, {
beginGlobalLoad: beginGlobalLoad,
endGlobalLoad: endGlobalLoad
})(AsyncConnectWithContext));
})(withRouter(AsyncConnectWithContext));

@@ -73,3 +73,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

return _extends({}, mapStateToProps(getImmutableState(mutableState), ownProps), asyncStateToProps);
return _extends({}, mapStateToProps(getImmutableState(mutableState), ownProps), {}, asyncStateToProps);
};

@@ -76,0 +76,0 @@

@@ -153,3 +153,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

if (filter(item, component)) {
var promiseOrResult = item.promise(_extends({}, rest, routeParams, {
var promiseOrResult = item.promise(_extends({}, rest, {}, routeParams, {
location: location,

@@ -156,0 +156,0 @@ routes: routes

@@ -22,4 +22,6 @@ "use strict";

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

@@ -31,4 +33,2 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var AsyncConnect =

@@ -62,3 +62,4 @@ /*#__PURE__*/

_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
// eslint-disable-line camelcase
var _this$props = this.props,

@@ -140,4 +141,3 @@ location = _this$props.location,

exports.AsyncConnect = AsyncConnect;
_defineProperty(AsyncConnect, "defaultProps", {
AsyncConnect.defaultProps = {
helpers: {},

@@ -147,11 +147,11 @@ reloadOnPropsChange: function reloadOnPropsChange() {

},
render: function render(_ref4) {
var routes = _ref4.routes;
render: function render(_ref2) {
var routes = _ref2.routes;
return (0, _reactRouterConfig.renderRoutes)(routes);
}
});
};
var AsyncConnectWithContext = function AsyncConnectWithContext(_ref2) {
var context = _ref2.context,
otherProps = _objectWithoutPropertiesLoose(_ref2, ["context"]);
var AsyncConnectWithContext = function AsyncConnectWithContext(_ref3) {
var context = _ref3.context,
otherProps = _objectWithoutPropertiesLoose(_ref3, ["context"]);

@@ -164,4 +164,4 @@ var Context = context || _reactRedux.ReactReduxContext;

return _react.default.createElement(Context.Consumer, null, function (_ref3) {
var reduxConnectStore = _ref3.store;
return _react.default.createElement(Context.Consumer, null, function (_ref4) {
var reduxConnectStore = _ref4.store;
return _react.default.createElement(AsyncConnect, _extends({

@@ -168,0 +168,0 @@ reduxConnectStore: reduxConnectStore

@@ -16,7 +16,7 @@ "use strict";

var _default = (0, _reactRouter.withRouter)((0, _reactRedux.connect)(null, {
var _default = (0, _reactRedux.connect)(null, {
beginGlobalLoad: _store.beginGlobalLoad,
endGlobalLoad: _store.endGlobalLoad
})(_AsyncConnect.default));
})((0, _reactRouter.withRouter)(_AsyncConnect.default));
exports.default = _default;

@@ -82,3 +82,3 @@ "use strict";

return _extends({}, mapStateToProps((0, _state.getImmutableState)(mutableState), ownProps), asyncStateToProps);
return _extends({}, mapStateToProps((0, _state.getImmutableState)(mutableState), ownProps), {}, asyncStateToProps);
};

@@ -85,0 +85,0 @@

@@ -168,3 +168,3 @@ "use strict";

if (filter(item, component)) {
var promiseOrResult = item.promise(_extends({}, rest, routeParams, {
var promiseOrResult = item.promise(_extends({}, rest, {}, routeParams, {
location: location,

@@ -171,0 +171,0 @@ routes: routes

@@ -11,24 +11,2 @@ /* eslint-disable react/forbid-prop-types,react/no-unused-prop-types,react/require-default-props */

export class AsyncConnect extends Component {
static propTypes = {
render: PropTypes.func,
beginGlobalLoad: PropTypes.func.isRequired,
endGlobalLoad: PropTypes.func.isRequired,
reloadOnPropsChange: PropTypes.func,
routes: PropTypes.array.isRequired,
location: PropTypes.object.isRequired,
match: PropTypes.object.isRequired,
helpers: PropTypes.any,
reduxConnectStore: PropTypes.object.isRequired,
};
static defaultProps = {
helpers: {},
reloadOnPropsChange() {
return true;
},
render({ routes }) {
return renderRoutes(routes);
},
};
constructor(props) {

@@ -55,3 +33,3 @@ super(props);

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) { // eslint-disable-line camelcase
const { location, reloadOnPropsChange } = this.props;

@@ -87,3 +65,3 @@ const navigated = location !== nextProps.location;

beginGlobalLoad();
return (loadDataCounterOriginal => loadResult.then(() => {
return ((loadDataCounterOriginal) => loadResult.then(() => {
// We need to change propsToShow only if loadAsyncData that called this promise

@@ -119,2 +97,24 @@ // is the last invocation of loadAsyncData method. Otherwise we can face a situation

AsyncConnect.propTypes = {
render: PropTypes.func,
beginGlobalLoad: PropTypes.func.isRequired,
endGlobalLoad: PropTypes.func.isRequired,
reloadOnPropsChange: PropTypes.func,
routes: PropTypes.array.isRequired,
location: PropTypes.object.isRequired,
match: PropTypes.object.isRequired,
helpers: PropTypes.any,
reduxConnectStore: PropTypes.object.isRequired,
};
AsyncConnect.defaultProps = {
helpers: {},
reloadOnPropsChange() {
return true;
},
render({ routes }) {
return renderRoutes(routes);
},
};
const AsyncConnectWithContext = ({ context, ...otherProps }) => {

@@ -121,0 +121,0 @@ const Context = context || ReactReduxContext;

@@ -6,5 +6,5 @@ import { connect } from 'react-redux';

export default withRouter(connect(null, {
export default connect(null, {
beginGlobalLoad,
endGlobalLoad,
})(AsyncConnectWithContext));
})(withRouter(AsyncConnectWithContext));

@@ -28,4 +28,4 @@ import { connect } from 'react-redux';

next
.then(data => dispatch(loadSuccess(key, data)))
.catch(err => dispatch(loadFail(key, err)));
.then((data) => dispatch(loadSuccess(key, data)))
.catch((err) => dispatch(loadFail(key, err)));
} else if (next) {

@@ -32,0 +32,0 @@ dispatch(loadSuccess(key, next));

// Global vars holding the custom state conversion methods. Default is just identity methods
const identity = arg => arg;
const identity = (arg) => arg;

@@ -28,3 +28,3 @@ // default pass-through functions

*/
export const getImmutableState = state => immutableStateFunc(state);
export const getImmutableState = (state) => immutableStateFunc(state);

@@ -35,2 +35,2 @@ /**

*/
export const getMutableState = state => mutableStateFunc(state);
export const getMutableState = (state) => mutableStateFunc(state);

@@ -53,3 +53,3 @@ import { matchRoutes } from 'react-router-config';

const keys = Object.keys(component);
keys.forEach(key => iterator(component[key], i, key));
keys.forEach((key) => iterator(component[key], i, key));
} else {

@@ -136,3 +136,3 @@ iterator(component, i);

if (isPromise(promiseOrResult)) {
promiseOrResult = promiseOrResult.catch(error => ({ error }));
promiseOrResult = promiseOrResult.catch((error) => ({ error }));
}

@@ -147,3 +147,3 @@

return Promise.all(results)
.then(finalResults => finalResults.reduce((finalResult, result, idx) => {
.then((finalResults) => finalResults.reduce((finalResult, result, idx) => {
const { key } = asyncItemsArr[idx];

@@ -150,0 +150,0 @@ if (key) {

@@ -7,3 +7,3 @@ import { createAction, handleActions } from 'redux-actions';

export const endGlobalLoad = createAction('@redux-conn/END_GLOBAL_LOAD');
export const load = createAction('@redux-conn/LOAD', key => ({ key }));
export const load = createAction('@redux-conn/LOAD', (key) => ({ key }));
export const loadSuccess = createAction('@redux-conn/LOAD_SUCCESS', (key, data) => ({ key, data }));

@@ -18,3 +18,3 @@ export const loadFail = createAction('@redux-conn/LOAD_FAIL', (key, error) => ({ key, error }));

export const reducer = handleActions({
[beginGlobalLoad]: state => ({
[beginGlobalLoad]: (state) => ({
...state,

@@ -24,3 +24,3 @@ loaded: false,

[endGlobalLoad]: state => ({
[endGlobalLoad]: (state) => ({
...state,

@@ -27,0 +27,0 @@ loaded: true,

{
"name": "redux-connect",
"version": "9.0.0",
"version": "10.0.0",
"description": "It allows you to request async data, store them in redux state and connect them to your react component.",

@@ -13,3 +13,3 @@ "main": "lib/index.js",

"scripts": {
"build": "npm run build:lib && npm run build:es",
"build": "yarn build:lib && yarn build:es",
"prebuild:lib": "rm -rf lib/*",

@@ -43,45 +43,45 @@ "build:lib": "cross-env NODE_ENV=production babel --out-dir lib modules",

"peerDependencies": {
"prop-types": "16.x.x",
"react": "16.x.x",
"react-redux": "6.x.x",
"react-router": "4.x.x",
"react-router-config": "1.x.x || ^1.0.0-beta || ^4.4.0-beta.6",
"react-router-dom": "^4.3.1",
"prop-types": "15.x.x",
"react": "^16.8.4",
"react-redux": "7.x.x",
"react-router": "5.x.x",
"react-router-config": "5.x.x",
"react-router-dom": "5.x.x",
"redux-actions": "2.x.x"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-export-default-from": "^7.5.2",
"@babel/preset-env": "^7.6.3",
"@babel/preset-react": "^7.6.3",
"babel-eslint": "^10.0.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"bluebird": "^3.5.3",
"cross-env": "^5.2.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.10.0",
"eslint": "^5.15.1",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-react": "^7.12.4",
"bluebird": "^3.7.1",
"cross-env": "^6.0.3",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^6.5.1",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^2.1.2",
"immutable": "^3.8.2",
"jest": "^24.3.1",
"jest": "^24.9.0",
"prop-types": "^15.7.2",
"raf": "^3.4.1",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-redux": "^6.0.1",
"react-router": "4.3.1",
"react-router-config": "^4.4.0-beta.6",
"react-router-dom": "^4.3.1",
"react-test-renderer": "^16.8.4",
"redux": "^4.0.1",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-redux": "^7.1.1",
"react-router": "^5.1.2",
"react-router-config": "^5.1.1",
"react-router-dom": "^5.1.2",
"react-test-renderer": "^16.10.2",
"redux": "^4.0.4",
"redux-actions": "^2.6.5",
"redux-immutable": "^4.0.0",
"regenerator-runtime": "^0.13.1",
"sinon": "^7.2.7"
"regenerator-runtime": "^0.13.3",
"sinon": "^7.5.0"
},

@@ -88,0 +88,0 @@ "jest": {

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