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 8.0.0 to 9.0.0

51

es/components/AsyncConnect.js
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 _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

@@ -7,2 +9,3 @@

/* eslint-disable react/forbid-prop-types,react/no-unused-prop-types,react/require-default-props */
import React, { Component } from 'react';

@@ -12,2 +15,3 @@ import PropTypes from 'prop-types';

import { renderRoutes } from 'react-router-config';
import { ReactReduxContext } from 'react-redux';
import { loadAsyncConnect } from '../helpers/utils';

@@ -20,6 +24,6 @@ import { getMutableState } from '../helpers/state';

function AsyncConnect(props, context) {
function AsyncConnect(props) {
var _this;
_this = _Component.call(this, props, context) || this;
_this = _Component.call(this, props) || this;
_this.state = {

@@ -60,10 +64,12 @@ previousLocation: _this.isLoaded() ? null : props.location

_proto.isLoaded = function isLoaded() {
var store = this.context.store;
return getMutableState(store.getState()).reduxAsyncConnect.loaded;
var reduxConnectStore = this.props.reduxConnectStore;
return getMutableState(reduxConnectStore.getState()).reduxAsyncConnect.loaded;
};
_proto.loadAsyncData = function loadAsyncData(props) {
_proto.loadAsyncData = function loadAsyncData(_ref) {
var _this2 = this;
var store = this.context.store;
var reduxConnectStore = _ref.reduxConnectStore,
otherProps = _objectWithoutPropertiesLoose(_ref, ["reduxConnectStore"]);
var _this$props2 = this.props,

@@ -73,4 +79,4 @@ location = _this$props2.location,

endGlobalLoad = _this$props2.endGlobalLoad;
var loadResult = loadAsyncConnect(_extends({}, props, {
store: store
var loadResult = loadAsyncConnect(_extends({}, otherProps, {
store: reduxConnectStore
}));

@@ -120,7 +126,2 @@ this.setState({

_defineProperty(AsyncConnect, "contextTypes", {
store: PropTypes.object.isRequired // eslint-disable-line react/forbid-prop-types
});
_defineProperty(AsyncConnect, "defaultProps", {

@@ -131,4 +132,4 @@ helpers: {},

},
render: function render(_ref) {
var routes = _ref.routes;
render: function render(_ref4) {
var routes = _ref4.routes;
return renderRoutes(routes);

@@ -138,2 +139,20 @@ }

export default AsyncConnect;
var AsyncConnectWithContext = function AsyncConnectWithContext(_ref2) {
var context = _ref2.context,
otherProps = _objectWithoutPropertiesLoose(_ref2, ["context"]);
var Context = context || ReactReduxContext;
if (Context == null) {
throw new Error('Please upgrade to react-redux v6');
}
return React.createElement(Context.Consumer, null, function (_ref3) {
var reduxConnectStore = _ref3.store;
return React.createElement(AsyncConnect, _extends({
reduxConnectStore: reduxConnectStore
}, otherProps));
});
};
export default AsyncConnectWithContext;
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import { AsyncConnect } from '../components/AsyncConnect';
import AsyncConnectWithContext from '../components/AsyncConnect';
import { beginGlobalLoad, endGlobalLoad } from '../store';

@@ -8,2 +8,2 @@ export default withRouter(connect(null, {

endGlobalLoad: endGlobalLoad
})(AsyncConnect));
})(AsyncConnectWithContext));

@@ -14,2 +14,4 @@ "use strict";

var _reactRedux = require("react-redux");
var _utils = require("../helpers/utils");

@@ -25,2 +27,4 @@

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

@@ -35,6 +39,6 @@

function AsyncConnect(props, context) {
function AsyncConnect(props) {
var _this;
_this = _Component.call(this, props, context) || this;
_this = _Component.call(this, props) || this;
_this.state = {

@@ -75,10 +79,12 @@ previousLocation: _this.isLoaded() ? null : props.location

_proto.isLoaded = function isLoaded() {
var store = this.context.store;
return (0, _state.getMutableState)(store.getState()).reduxAsyncConnect.loaded;
var reduxConnectStore = this.props.reduxConnectStore;
return (0, _state.getMutableState)(reduxConnectStore.getState()).reduxAsyncConnect.loaded;
};
_proto.loadAsyncData = function loadAsyncData(props) {
_proto.loadAsyncData = function loadAsyncData(_ref) {
var _this2 = this;
var store = this.context.store;
var reduxConnectStore = _ref.reduxConnectStore,
otherProps = _objectWithoutPropertiesLoose(_ref, ["reduxConnectStore"]);
var _this$props2 = this.props,

@@ -88,4 +94,4 @@ location = _this$props2.location,

endGlobalLoad = _this$props2.endGlobalLoad;
var loadResult = (0, _utils.loadAsyncConnect)(_extends({}, props, {
store: store
var loadResult = (0, _utils.loadAsyncConnect)(_extends({}, otherProps, {
store: reduxConnectStore
}));

@@ -137,7 +143,2 @@ this.setState({

_defineProperty(AsyncConnect, "contextTypes", {
store: _propTypes.default.object.isRequired // eslint-disable-line react/forbid-prop-types
});
_defineProperty(AsyncConnect, "defaultProps", {

@@ -148,4 +149,4 @@ helpers: {},

},
render: function render(_ref) {
var routes = _ref.routes;
render: function render(_ref4) {
var routes = _ref4.routes;
return (0, _reactRouterConfig.renderRoutes)(routes);

@@ -155,3 +156,21 @@ }

var _default = AsyncConnect;
var AsyncConnectWithContext = function AsyncConnectWithContext(_ref2) {
var context = _ref2.context,
otherProps = _objectWithoutPropertiesLoose(_ref2, ["context"]);
var Context = context || _reactRedux.ReactReduxContext;
if (Context == null) {
throw new Error('Please upgrade to react-redux v6');
}
return _react.default.createElement(Context.Consumer, null, function (_ref3) {
var reduxConnectStore = _ref3.store;
return _react.default.createElement(AsyncConnect, _extends({
reduxConnectStore: reduxConnectStore
}, otherProps));
});
};
var _default = AsyncConnectWithContext;
exports.default = _default;

@@ -10,11 +10,13 @@ "use strict";

var _AsyncConnect = require("../components/AsyncConnect");
var _AsyncConnect = _interopRequireDefault(require("../components/AsyncConnect"));
var _store = require("../store");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _reactRouter.withRouter)((0, _reactRedux.connect)(null, {
beginGlobalLoad: _store.beginGlobalLoad,
endGlobalLoad: _store.endGlobalLoad
})(_AsyncConnect.AsyncConnect));
})(_AsyncConnect.default));
exports.default = _default;

@@ -0,1 +1,2 @@

/* eslint-disable react/forbid-prop-types,react/no-unused-prop-types,react/require-default-props */
import React, { Component } from 'react';

@@ -5,2 +6,3 @@ import PropTypes from 'prop-types';

import { renderRoutes } from 'react-router-config';
import { ReactReduxContext } from 'react-redux';
import { loadAsyncConnect } from '../helpers/utils';

@@ -15,3 +17,2 @@ import { getMutableState } from '../helpers/state';

reloadOnPropsChange: PropTypes.func,
/* eslint-disable react/forbid-prop-types, react/no-unused-prop-types */
routes: PropTypes.array.isRequired,

@@ -21,9 +22,5 @@ location: PropTypes.object.isRequired,

helpers: PropTypes.any,
/* eslint-enable */
reduxConnectStore: PropTypes.object.isRequired,
};
static contextTypes = {
store: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
};
static defaultProps = {

@@ -39,4 +36,4 @@ helpers: {},

constructor(props, context) {
super(props, context);
constructor(props) {
super(props);

@@ -76,10 +73,12 @@ this.state = {

isLoaded() {
const { store } = this.context;
return getMutableState(store.getState()).reduxAsyncConnect.loaded;
const { reduxConnectStore } = this.props;
return getMutableState(reduxConnectStore.getState()).reduxAsyncConnect.loaded;
}
loadAsyncData(props) {
const { store } = this.context;
loadAsyncData({ reduxConnectStore, ...otherProps }) {
const { location, beginGlobalLoad, endGlobalLoad } = this.props;
const loadResult = loadAsyncConnect({ ...props, store });
const loadResult = loadAsyncConnect({
...otherProps,
store: reduxConnectStore,
});

@@ -96,3 +95,6 @@ this.setState({ previousLocation: location });

// loaded props last time and not the last called route
if (this.loadDataCounter === loadDataCounterOriginal && this.mounted !== false) {
if (
this.loadDataCounter === loadDataCounterOriginal
&& this.mounted !== false
) {
this.setState({ previousLocation: null });

@@ -120,2 +122,25 @@ }

export default AsyncConnect;
const AsyncConnectWithContext = ({ context, ...otherProps }) => {
const Context = context || ReactReduxContext;
if (Context == null) {
throw new Error('Please upgrade to react-redux v6');
}
return (
<Context.Consumer>
{({ store: reduxConnectStore }) => (
<AsyncConnect
reduxConnectStore={reduxConnectStore}
{...otherProps}
/>
)}
</Context.Consumer>
);
};
AsyncConnectWithContext.propTypes = {
context: PropTypes.object,
};
export default AsyncConnectWithContext;
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import { AsyncConnect } from '../components/AsyncConnect';
import AsyncConnectWithContext from '../components/AsyncConnect';
import { beginGlobalLoad, endGlobalLoad } from '../store';
export default withRouter(connect(null, { beginGlobalLoad, endGlobalLoad })(AsyncConnect));
export default withRouter(connect(null, {
beginGlobalLoad,
endGlobalLoad,
})(AsyncConnectWithContext));
{
"name": "redux-connect",
"version": "8.0.0",
"version": "9.0.0",
"description": "It allows you to request async data, store them in redux state and connect them to your react component.",

@@ -42,46 +42,46 @@ "main": "lib/index.js",

"peerDependencies": {
"prop-types": "15.x.x || 16.x.x",
"prop-types": "16.x.x",
"react": "16.x.x",
"react-redux": "5.x.x",
"react-redux": "6.x.x",
"react-router": "4.x.x",
"react-router-config": "1.x.x || ^1.0.0-beta"
"react-router-config": "1.x.x || ^1.0.0-beta || ^4.4.0-beta.6",
"react-router-dom": "^4.3.1",
"redux-actions": "2.x.x"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.55",
"@babel/core": "^7.0.0-beta.55",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.55",
"@babel/plugin-proposal-export-default-from": "^7.0.0-beta.55",
"@babel/preset-env": "^7.0.0-beta.55",
"@babel/preset-react": "^7.0.0-beta.55",
"@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": "^8.2.6",
"babel-jest": "^23.4.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.13",
"bluebird": "^3.5.1",
"babel-eslint": "^10.0.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"bluebird": "^3.5.3",
"cross-env": "^5.2.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^5.2.0",
"eslint-config-airbnb": "^17.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "6.1.1",
"eslint-plugin-react": "^7.10.0",
"immutable": "^3.8.1",
"jest": "^23.4.2",
"prop-types": "^15.6.2",
"raf": "^3.3.2",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-redux": "^5.0.7",
"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",
"immutable": "^3.8.2",
"jest": "^24.3.1",
"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": "^1.0.0 || ^1.0.0-beta",
"react-test-renderer": "^16.4.2",
"redux": "^4.0.0",
"react-router-config": "^4.4.0-beta.6",
"react-router-dom": "^4.3.1",
"react-test-renderer": "^16.8.4",
"redux": "^4.0.1",
"redux-actions": "^2.6.5",
"redux-immutable": "^4.0.0",
"regenerator-runtime": "^0.12.0",
"sinon": "^6.1.4"
"regenerator-runtime": "^0.13.1",
"sinon": "^7.2.7"
},
"dependencies": {
"redux-actions": "^2.6.1"
},
"jest": {

@@ -91,5 +91,2 @@ "automock": false,

"testURL": "http://localhost",
"transform": {
".*": "<rootDir>/node_modules/babel-jest"
},
"setupFiles": [

@@ -96,0 +93,0 @@ "raf/polyfill"

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