redux-first-history
Advanced tools
Comparing version 5.0.0-beta.1 to 5.0.0-beta.2
131
package.json
{ | ||
"name": "redux-first-history", | ||
"version": "5.0.0-beta.1", | ||
"description": "Redux First History - Redux history binding support react-router - @reach/router - wouter", | ||
"main": "lib/index.js", | ||
"module": "lib/index.esm.js", | ||
"types": "types/index.d.ts", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"start": "rollup -c -w", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm run build", | ||
"test": "jest --config ./.jestrc.json", | ||
"test:watch": "npm run test -- --watch" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/salvoravida/redux-first-history.git" | ||
}, | ||
"keywords": [ | ||
"redux-first-history", | ||
"redux", | ||
"first", | ||
"history", | ||
"react", | ||
"router", | ||
"connected", | ||
"react-router-redux", | ||
"react-router", | ||
"connected-react-router", | ||
"@reach/router", | ||
"wouter" | ||
], | ||
"author": "Salvatore Ravidà", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/salvoravida/redux-first-history/issues" | ||
}, | ||
"homepage": "https://github.com/salvoravida/redux-first-history#readme", | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
"history": "^4.7.2 || ^5.0", | ||
"redux": "^3.6.0 || ^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "7.10.5", | ||
"@babel/core": "7.11.4", | ||
"@babel/plugin-transform-modules-commonjs": "7.10.4", | ||
"@babel/preset-env": "7.11.0", | ||
"@salvoravida/eslint-config": "0.0.4", | ||
"@types/reach__router": "1.3.5", | ||
"history": "4.10.1", | ||
"jest": "26.4.2", | ||
"redux": "4.0.5", | ||
"rollup": "2.26.8", | ||
"rollup-plugin-babel": "4.4.0", | ||
"tiny-invariant": "1.1.0" | ||
} | ||
"name": "redux-first-history", | ||
"version": "5.0.0-beta.2", | ||
"description": "Redux First History - Redux history binding support react-router - @reach/router - wouter", | ||
"main": "build/es5/index.js", | ||
"module": "build/es6/index.js", | ||
"types": "build/es6/index.d.ts", | ||
"scripts": { | ||
"build:clean": "rimraf build", | ||
"build:es5": "tsc -p tsconfig.json", | ||
"build:es6": "tsc -p tsconfigEs6.json", | ||
"build": "npm run build:clean && npm run build:es5 && npm run build:es6", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage && npx make-coverage-badge --output-path=cov-badge.svg", | ||
"watch": "tsc -p tsconfigEs6.json -w", | ||
"prepare": "npm run build", | ||
"prepublish": "npm run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/salvoravida/redux-first-history.git" | ||
}, | ||
"keywords": [ | ||
"redux-first-history", | ||
"redux", | ||
"first", | ||
"history", | ||
"react", | ||
"router", | ||
"connected", | ||
"react-router-redux", | ||
"react-router", | ||
"connected-react-router", | ||
"@reach/router", | ||
"wouter" | ||
], | ||
"author": "Salvatore Ravidà", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/salvoravida/redux-first-history/issues" | ||
}, | ||
"homepage": "https://github.com/salvoravida/redux-first-history#readme", | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
"history": "^4.7.2 || ^5.0", | ||
"redux": "^3.6.0 || ^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@reach/router": "^1.3.4", | ||
"@testing-library/react": "^11.2.6", | ||
"@types/history": "^4.7.8", | ||
"@types/jest": "^26.0.23", | ||
"@types/reach__router": "^1.3.7", | ||
"@types/react": "^17.0.4", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"eslint": "^7.17.0", | ||
"eslint-config-airbnb": "^18.2.1", | ||
"eslint-config-prettier": "^7.1.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-react": "^7.22.0", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"history": "^4.10.1", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.2.1", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"redux": "^4.1.0", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^26.5.5", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.3" | ||
} | ||
} |
# redux-first-history | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/redux-first-history"><img src="https://img.shields.io/npm/v/redux-first-history.svg?style=flat-square"></a> | ||
<a href="https://www.npmjs.com/package/redux-first-history"><img src="https://img.shields.io/npm/dt/redux-first-history.svg?style=flat-square"></a><br/> | ||
<a href="https://www.npmjs.com/package/redux-first-history"><img src="https://img.shields.io/npm/dt/redux-first-history.svg?style=flat-square"></a> | ||
<img src="./cov-badge.svg"></a><br/> | ||
Redux First History - Make Redux 100% SINGLE-AND-ONLY source of truth! | ||
@@ -57,4 +58,4 @@ </p> | ||
* improve React shallowCompare as there is only one "location" | ||
* support react-router v4 and v5 | ||
* support @reach/router 1.2.1 | ||
* support react-router v4 / v5 / v6 | ||
* support @reach/router 1.x | ||
* support @wouter 2.x | ||
@@ -64,3 +65,2 @@ * support mix react-router, @reach-router & wouter in the same app! | ||
* handle Redux Travelling from devTools (that's a non sense in production, but at the end of the day this decision it's up to you ...) | ||
* custom options and blazing fast (ok, every lib should have these features, that's true :D) | ||
@@ -90,3 +90,3 @@ Installation | ||
history: createBrowserHistory(), | ||
//others options if needed | ||
//other options if needed | ||
}); | ||
@@ -137,3 +137,3 @@ | ||
So you may have components that take location from store, others that take location from router context, and others from withRouter HOC. If you are on a big crazy already-messed-up project, you could see also connect(withRouter) or withRouter(connect) .... | ||
So you may have components that take location from store, others that take location from router context, and others from withRouter HOC. | ||
@@ -163,5 +163,5 @@ This sometimes could generate sync issue, due to the fact that many components are updated at different time. | ||
|--- |---|--- | | ||
|history | no| The `history/createBrowserHistory` object - currently tested only with version 4.7.2 - 4.10.1 | | ||
|history | no| The `createBrowserHistory` object - currently tested only with version 4.7.2 - 4.10.1 | | ||
|routerReducerKey | yes | if you don't like `router` name for reducer. | ||
|oldLocationChangePayload | yes | if you use the old`LOCATION_CHANGE`payload`{ ...location }`instead of the new`{ location }`, setting this flag will make you able to not change your app at all! | ||
|oldLocationChangePayload | yes | if you use the old`LOCATION_CHANGE`payload`{ ...location }`instead of the new`{ location }`, setting this flag will make you able to not change your app at all! (removed in v5) | ||
|reduxTravelling | yes | if you want to play with redux-dev-tools :D. | ||
@@ -173,2 +173,29 @@ |selectRouterState |yes | custom selector for router state. With redux-immutable selectRouterState = state => state.get("router") | ||
# Advanced config | ||
* support "navigate" from @reach/router | ||
```javascript | ||
import { createReduxHistoryContext, reachify } from "redux-first-history"; | ||
import { createBrowserHistory } from 'history'; | ||
import { globalHistory } from '@reach/router'; | ||
const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({ | ||
history: createBrowserHistory(), | ||
reachGlobalHistory: globalHistory, | ||
//other options if needed | ||
}); | ||
``` | ||
* React batch updates: top-down batch updates for maximum performance. Fix also some update edge cases. | ||
```javascript | ||
import { createReduxHistoryContext, reachify } from "redux-first-history"; | ||
import { createBrowserHistory } from 'history'; | ||
import { unstable_batchedUpdates } from 'react-dom'; | ||
const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({ | ||
history: createBrowserHistory(), | ||
batch: unstable_batchedUpdates, | ||
//other options if needed | ||
}); | ||
``` | ||
# Feedback | ||
@@ -179,11 +206,2 @@ | ||
# Todo | ||
* test, test and test! | ||
* code clean and split | ||
* warning for uncorrect usage | ||
* try to use it with non-react-like other framework! | ||
* redux-first-app POC | ||
any idea? let me know and contribute! | ||
# credits & inspiration | ||
@@ -190,0 +208,0 @@ - redux-first-routing |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
66597
47
795
212
26