connected-react-router
Advanced tools
Comparing version 6.9.2 to 7.0.0-alpha.0
@@ -5,2 +5,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
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; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -29,3 +35,3 @@ | ||
import { connect, ReactReduxContext } from 'react-redux'; | ||
import { Router } from 'react-router'; | ||
import { Router } from 'react-router-dom'; | ||
import isEqualWith from 'lodash.isequalwith'; | ||
@@ -90,10 +96,11 @@ import { onLocationChanged as _onLocationChanged } from './actions'; | ||
search: searchInStore, | ||
hash: hashInStore, | ||
state: stateInStore | ||
}); | ||
hash: hashInStore | ||
}, _objectSpread({}, stateInStore)); | ||
} | ||
}); | ||
var handleLocationChange = function handleLocationChange(location, action) { | ||
var isFirstRendering = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
var handleLocationChange = function handleLocationChange(_ref) { | ||
var location = _ref.location, | ||
action = _ref.action; | ||
var isFirstRendering = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
@@ -115,3 +122,6 @@ // Dispatch onLocationChanged except when we're in time travelling | ||
// But, we add `isFirstRendering` to `true` to prevent double-rendering. | ||
handleLocationChange(history.location, history.action, true); | ||
handleLocationChange({ | ||
location: history.location, | ||
action: history.action | ||
}, true); | ||
} | ||
@@ -143,3 +153,4 @@ | ||
return /*#__PURE__*/React.createElement(Router, { | ||
history: history | ||
location: history.location, | ||
navigator: history | ||
}, children); | ||
@@ -187,4 +198,4 @@ } | ||
return /*#__PURE__*/React.createElement(Context.Consumer, null, function (_ref) { | ||
var store = _ref.store; | ||
return /*#__PURE__*/React.createElement(Context.Consumer, null, function (_ref2) { | ||
var store = _ref2.store; | ||
return /*#__PURE__*/React.createElement(ConnectedRouter, _extends({ | ||
@@ -191,0 +202,0 @@ store: store |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
import { matchPath } from "react-router"; | ||
import { matchRoutes } from "react-router"; | ||
@@ -37,3 +37,3 @@ var createSelectors = function createSelectors(structure) { | ||
return toJS(getIn(getRouter(state), ['location', 'hash'])); | ||
}; // It only makes sense to recalculate the `matchPath` whenever the pathname | ||
}; // It only makes sense to recalculate the `matchRoutes` whenever the pathname | ||
// of the location changes. That's why `createMatchSelector` memoizes | ||
@@ -43,3 +43,3 @@ // the latest result based on the location's pathname. | ||
var createMatchSelector = function createMatchSelector(path) { | ||
var createMatchSelector = function createMatchSelector(routes) { | ||
var lastPathname = null; | ||
@@ -56,9 +56,4 @@ var lastMatch = null; | ||
lastPathname = pathname; | ||
var match = matchPath(pathname, path); | ||
if (!match || !lastMatch || match.url !== lastMatch.url // When URL matched for nested routes, URL is the same but isExact is not. | ||
|| match.isExact !== lastMatch.isExact) { | ||
lastMatch = match; | ||
} | ||
var match = matchRoutes(routes, pathname); | ||
lastMatch = match; | ||
return lastMatch; | ||
@@ -65,0 +60,0 @@ }; |
@@ -14,3 +14,3 @@ "use strict"; | ||
var _reactRouter = require("react-router"); | ||
var _reactRouterDom = require("react-router-dom"); | ||
@@ -33,2 +33,8 @@ var _lodash = _interopRequireDefault(require("lodash.isequalwith")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
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; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -109,10 +115,11 @@ | ||
search: searchInStore, | ||
hash: hashInStore, | ||
state: stateInStore | ||
}); | ||
hash: hashInStore | ||
}, _objectSpread({}, stateInStore)); | ||
} | ||
}); | ||
var handleLocationChange = function handleLocationChange(location, action) { | ||
var isFirstRendering = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
var handleLocationChange = function handleLocationChange(_ref) { | ||
var location = _ref.location, | ||
action = _ref.action; | ||
var isFirstRendering = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
@@ -134,3 +141,6 @@ // Dispatch onLocationChanged except when we're in time travelling | ||
// But, we add `isFirstRendering` to `true` to prevent double-rendering. | ||
handleLocationChange(history.location, history.action, true); | ||
handleLocationChange({ | ||
location: history.location, | ||
action: history.action | ||
}, true); | ||
} | ||
@@ -161,4 +171,5 @@ | ||
return /*#__PURE__*/_react["default"].createElement(_reactRouter.Router, { | ||
history: history | ||
return /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Router, { | ||
location: history.location, | ||
navigator: history | ||
}, children); | ||
@@ -206,4 +217,4 @@ } | ||
return /*#__PURE__*/_react["default"].createElement(Context.Consumer, null, function (_ref) { | ||
var store = _ref.store; | ||
return /*#__PURE__*/_react["default"].createElement(Context.Consumer, null, function (_ref2) { | ||
var store = _ref2.store; | ||
return /*#__PURE__*/_react["default"].createElement(ConnectedRouter, _extends({ | ||
@@ -210,0 +221,0 @@ store: store |
@@ -44,3 +44,3 @@ "use strict"; | ||
return toJS(getIn(getRouter(state), ['location', 'hash'])); | ||
}; // It only makes sense to recalculate the `matchPath` whenever the pathname | ||
}; // It only makes sense to recalculate the `matchRoutes` whenever the pathname | ||
// of the location changes. That's why `createMatchSelector` memoizes | ||
@@ -50,3 +50,3 @@ // the latest result based on the location's pathname. | ||
var createMatchSelector = function createMatchSelector(path) { | ||
var createMatchSelector = function createMatchSelector(routes) { | ||
var lastPathname = null; | ||
@@ -63,9 +63,4 @@ var lastMatch = null; | ||
lastPathname = pathname; | ||
var match = (0, _reactRouter.matchPath)(pathname, path); | ||
if (!match || !lastMatch || match.url !== lastMatch.url // When URL matched for nested routes, URL is the same but isExact is not. | ||
|| match.isExact !== lastMatch.isExact) { | ||
lastMatch = match; | ||
} | ||
var match = (0, _reactRouter.matchRoutes)(routes, pathname); | ||
lastMatch = match; | ||
return lastMatch; | ||
@@ -72,0 +67,0 @@ }; |
{ | ||
"name": "connected-react-router", | ||
"version": "6.9.2", | ||
"version": "7.0.0-alpha.0", | ||
"description": "A Redux binding for React Router v4 and v5", | ||
@@ -31,14 +31,15 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"prop-types": "^15.7.2", | ||
"lodash.isequalwith": "^4.4.0" | ||
"lodash.isequalwith": "^4.4.0", | ||
"prop-types": "^15.7.2" | ||
}, | ||
"peerDependencies": { | ||
"history": "^4.7.2", | ||
"react": "^16.4.0 || ^17.0.0", | ||
"history": "^5.0.0", | ||
"react": "^16.8.3 || ^17.0.0", | ||
"react-redux": "^6.0.0 || ^7.1.0", | ||
"react-router": "^4.3.1 || ^5.0.0", | ||
"react-router": "^6.0.0", | ||
"react-router-dom": "^6.0.0", | ||
"redux": "^3.6.0 || ^4.0.0" | ||
}, | ||
"optionalDependencies": { | ||
"immutable": "^3.8.1 || ^4.0.0", | ||
"immutable": "^4.0.0", | ||
"seamless-immutable": "^7.1.3" | ||
@@ -51,2 +52,3 @@ }, | ||
"@babel/preset-react": "^7.0.0", | ||
"@redux-devtools/core": "^3.9.1", | ||
"@types/history": "^4.7.3", | ||
@@ -64,4 +66,2 @@ "@types/react": "*", | ||
"cross-env": "^6.0.3", | ||
"enzyme": "3.1.1", | ||
"enzyme-adapter-react-16": "^1.0.4", | ||
"eslint": "^5.9.0", | ||
@@ -73,9 +73,9 @@ "eslint-plugin-import": "^2.14.0", | ||
"raf": "^3.4.0", | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0", | ||
"react": "^16.8.3 || ^17.0.0", | ||
"react-dom": "^16.8.3 || ^17.0.0", | ||
"react-redux": "^6.0.0 || ^7.1.0", | ||
"react-router": "^4.3.1 || ^5.0.0", | ||
"react-router": "^6.0.0", | ||
"react-router-dom": "^6.0.0", | ||
"react-test-renderer": "^16.4.0", | ||
"redux": "^4.0.0", | ||
"redux-devtools": "^3.4.0", | ||
"redux-immutable": "^3.0.11", | ||
@@ -82,0 +82,0 @@ "redux-mock-store": "^1.2.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37
2696
437017
10
2