Skip to content

Commit

Permalink
Perf: replace spread with Object.assign (#1900)
Browse files Browse the repository at this point in the history
* perf: replace spread with Object.assign

* chore: update version

* chore: update pnpm-lock

Co-authored-by: lxr <1076629390@qq.com>
Co-authored-by: 潇见 <xiaojian.lj@antgroup.com>
  • Loading branch information
3 people committed Oct 18, 2022
1 parent d2e2afa commit 223852b
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 100 deletions.
54 changes: 27 additions & 27 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,50 @@
"prepare": "husky install"
},
"devDependencies": {
"@ant-design/icons": "^4.6.2",
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.2",
"@ant-design/icons": "^4.7.0",
"@babel/cli": "^7.19.3",
"@babel/core": "^7.19.3",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@testing-library/react": "^10.0.4",
"@testing-library/react": "^10.4.9",
"@testing-library/react-hooks": "^8.0.1",
"@types/jest": "^27.4.1",
"@types/lodash.debounce": "^4.0.6",
"@types/lodash.isequal": "^4.5.5",
"@types/lodash.throttle": "^4.1.6",
"@types/react-router": "^5.1.18",
"@umijs/fabric": "^2.1.0",
"@types/jest": "^27.5.2",
"@types/lodash.debounce": "^4.0.7",
"@types/lodash.isequal": "^4.5.6",
"@types/lodash.throttle": "^4.1.7",
"@types/react-router": "^5.1.19",
"@umijs/fabric": "^2.14.0",
"@umijs/plugin-sass": "^1.1.1",
"antd": "^4.3.3",
"babel-loader": "^8.1.0",
"babel-plugin-import": "^1.12.0",
"babel-plugin-transform-async-to-promises": "^0.8.15",
"antd": "^4.23.4",
"babel-loader": "^8.2.5",
"babel-plugin-import": "^1.13.5",
"babel-plugin-transform-async-to-promises": "^0.8.18",
"coveralls": "^3.1.1",
"del": "^5.1.0",
"dumi": "^1.1.48",
"enzyme": "^3.10.0",
"eslint": "^7.2.0",
"eslint-plugin-react-hooks": "^4.0.8",
"fast-glob": "^3.2.11",
"fs-extra": "^10.0.1",
"enzyme": "^3.11.0",
"eslint": "^7.32.0",
"eslint-plugin-react-hooks": "^4.6.0",
"fast-glob": "^3.2.12",
"fs-extra": "^10.1.0",
"gray-matter": "^4.0.3",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-typescript": "^6.0.0-alpha.1",
"husky": "^8.0.0",
"husky": "^8.0.1",
"jest": "^27.5.1",
"jest-fetch-mock": "^3.0.3",
"jest-localstorage-mock": "^2.4.18",
"jest-localstorage-mock": "^2.4.22",
"mockjs": "^1.1.0",
"prettier": "^2.0.5",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-drag-listview": "^0.1.6",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-drag-listview": "^0.1.9",
"react-shadow": "^19.0.3",
"react-test-renderer": "^16.13.1",
"react-test-renderer": "^16.14.0",
"rimraf": "^3.0.2",
"surge": "^0.21.3",
"surge": "^0.21.7",
"ts-jest": "^27.1.5",
"typescript": "^4.8.4",
"umi-request": "^1.2.18",
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/useSetState/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const useSetState = <S extends Record<string, any>>(
const setMergeState = useCallback((patch) => {
setState((prevState) => {
const newState = isFunction(patch) ? patch(prevState) : patch;
return newState ? { ...prevState, ...newState } : prevState;
return newState ? Object.assign({}, prevState, newState) : prevState;
});
}, []);

Expand Down

0 comments on commit 223852b

Please sign in to comment.