Skip to content

Commit

Permalink
Use immer instead of immutability-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
iwataka committed May 6, 2022
1 parent 3ab7ac4 commit 2eec3e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@types/react-dom": "^18.0.0",
"bootstrap": "^5.1.3",
"http-proxy-middleware": "^2.0.6",
"immutability-helper": "^3.1.1",
"immer": "^9.0.12",
"react": "^18.1.0",
"react-bootstrap": "^2.3.1",
"react-dom": "^18.1.0",
Expand Down
16 changes: 5 additions & 11 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import Alert from "react-bootstrap/Alert";
import Accordion from "react-bootstrap/Accordion";
import Form from "react-bootstrap/Form";
import Button from "react-bootstrap/Button";
import update from "immutability-helper";
import "./App.css";
import produce from "immer";

const httpStatusNotAuthenticated = 498;
const httpStatusNotSetup = 499;
Expand Down Expand Up @@ -151,10 +151,8 @@ class AppWithoutRouter extends React.Component<{}, any> {

setAuthStatus(status: number) {
this.setState(
update(this.state, {
auth: {
status: { $set: status },
},
produce(this.state, (draft) => {
draft.auth.status = status;
})
);
}
Expand Down Expand Up @@ -659,12 +657,8 @@ class Setup extends React.Component<SetupProps, any> {

updateState(typ: string, field: string, value: string) {
this.setState(
update(this.state, {
credential: {
[typ]: {
[field]: { $set: value },
},
},
produce(this.state, (draft) => {
draft.credential[typ][field] = value;
})
);
}
Expand Down
7 changes: 1 addition & 6 deletions web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4842,16 +4842,11 @@ ignore@^5.1.8, ignore@^5.2.0:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a"
integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==

immer@^9.0.7:
immer@^9.0.12, immer@^9.0.7:
version "9.0.12"
resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.12.tgz#2d33ddf3ee1d247deab9d707ca472c8c942a0f20"
integrity sha512-lk7UNmSbAukB5B6dh9fnh5D0bJTOFKxVg2cyJWTYrWRfhLrLMBquONcUs3aFq507hNoIZEDDh8lb8UtOizSMhA==

immutability-helper@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/immutability-helper/-/immutability-helper-3.1.1.tgz#2b86b2286ed3b1241c9e23b7b21e0444f52f77b7"
integrity sha512-Q0QaXjPjwIju/28TsugCHNEASwoCcJSyJV3uO1sOIQGI0jKgm9f41Lvz0DZj3n46cNCyAZTsEYoY4C2bVRUzyQ==

import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1:
version "3.3.0"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
Expand Down

0 comments on commit 2eec3e3

Please sign in to comment.