Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf: replace spread with Object.assign #1900

Merged
merged 5 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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