Skip to content

Commit

Permalink
chore(deps): update dependency react-hook-form to v6 (#62)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency react-hook-form to v6

* refactor(frontend): migrate to hook form v6

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: ManuC <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2020
1 parent 989ed0e commit 56f8916
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
3 changes: 2 additions & 1 deletion targets/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"dependencies": {
"@hapi/boom": "^9.1.0",
"@hapi/joi": "^17.1.1",
"@hookform/error-message": "^0.0.4",
"@reach/accordion": "^0.10.5",
"@reach/dialog": "^0.10.5",
"@reach/menu-button": "^0.10.5",
Expand Down Expand Up @@ -32,7 +33,7 @@
"polished": "^3.6.5",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-hook-form": "^5.7.2",
"react-hook-form": "^6.3.0",
"react-icons": "^3.10.0",
"react-is": "^16.13.1",
"semver": "^7.3.2",
Expand Down
10 changes: 6 additions & 4 deletions targets/frontend/src/components/forms/ErrorMessage.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/** @jsx jsx */

import { ErrorMessage } from "@hookform/error-message";
import PropTypes from "prop-types";
import { ErrorMessage } from "react-hook-form";
import { jsx } from "theme-ui";

export function FormErrorMessage({ errors, fieldName }) {
return (
<ErrorMessage errors={errors} name={fieldName}>
{({ message }) => <div sx={{ color: "critical" }}>{message}</div>}
</ErrorMessage>
<ErrorMessage
errors={errors}
name={fieldName}
render={({ message }) => <div sx={{ color: "critical" }}>{message}</div>}
/>
);
}

Expand Down
9 changes: 4 additions & 5 deletions targets/frontend/src/components/user/PasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ export function PasswordForm({
await onSubmit(data);
} catch (err) {
console.error("[ PasswordForm ]", err);
setError(
"oldPassword",
"validate",
"L'ancien mot de passe ne correspond pas."
);
setError("oldPassword", {
message: "L'ancien mot de passe ne correspond pas.",
type: "validate",
});
}
loading = false;
}
Expand Down
5 changes: 4 additions & 1 deletion targets/frontend/src/pages/reset_password.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export default function ResetPasswordPage() {
setSuccess(true);
} catch (error) {
console.error(error);
setError("email", "validate", "désolé, une erreur est survenue :(");
setError("email", {
message: "désolé, une erreur est survenue :(",
type: "validate",
});
}
loading = false;
}
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,11 @@
dependencies:
"@hapi/hoek" "^9.0.0"

"@hookform/error-message@^0.0.4":
version "0.0.4"
resolved "https://registry.yarnpkg.com/@hookform/error-message/-/error-message-0.0.4.tgz#a499aa62994af44da3d207f6ed01232f43b3a549"
integrity sha512-as5acnxkWuF5XrzHhZlzdXUk4zpHNzFLe+uGyaJtSrMbDVTvcNL62ESRK5DTVGPix8shJnt6G2LfrobHBPpvYg==

"@istanbuljs/load-nyc-config@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz#10602de5570baea82f8afbfa2630b24e7a8cfe5b"
Expand Down Expand Up @@ -11593,10 +11598,10 @@ react-focus-lock@^2.3.1:
use-callback-ref "^1.2.1"
use-sidecar "^1.0.1"

react-hook-form@^5.7.2:
version "5.7.2"
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-5.7.2.tgz#a84e259e5d37dd30949af4f79c4dac31101b79ac"
integrity sha512-bJvY348vayIvEUmSK7Fvea/NgqbT2racA2IbnJz/aPlQ3GBtaTeDITH6rtCa6y++obZzG6E3Q8VuoXPir7QYUg==
react-hook-form@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-6.3.0.tgz#5c1926d51d4532f44818ef73f96d1a8c11015a76"
integrity sha512-Xz7xxnILftxttc6H+miTSi2eYPehiW3XdsPaqY5dW8HcURFZPrnpxnmaRqz6JtZcbfRM8qjjppP/pOBaUzhn4w==

react-icons@^3.10.0:
version "3.10.0"
Expand Down

0 comments on commit 56f8916

Please sign in to comment.