Skip to content

Commit

Permalink
Merge pull request #3 from kwameopareasiedu/remove-validate-on-reset
Browse files Browse the repository at this point in the history
Remove validate on reset
  • Loading branch information
kwameopareasiedu authored Jun 10, 2024
2 parents 1a66fac + 891f05e commit 562f73e
Show file tree
Hide file tree
Showing 6 changed files with 332 additions and 330 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,8 @@ form.handleSubmit((values: T) => void): (values: T) => void
## Contributors

- [Kwame Opare Asiedu](https://github.com/kwameopareasiedu)

## Changelog

- 1.0.2 (Current)
- Disabled call to `form.validateField` on `form.reset` to avoid errors on form reset
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function App() {
const form = new Form({
initialValues: {
input: "",
range: 50,
range: 30,
select: "",
radio: "",
checkbox: false
Expand Down
32 changes: 19 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{
"name": "vanjs-form",
"version": "1.0.1",
"version": "1.0.2",
"description": "Fully typed form state management library (with validation) for VanJS",
"repository": "https://github.com/kwameopareasiedu/vanjs-form",
"homepage": "https://github.com/kwameopareasiedu/vanjs-form",
"keywords": ["vanjs", "form", "validation"],
"maintainers": ["Kwame Opare Asiedu"],
"keywords": [
"vanjs",
"form",
"validation"
],
"maintainers": [
"Kwame Opare Asiedu"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Kwame Opare Asiedu",
Expand All @@ -18,18 +24,18 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^8.56.0",
"prettier": "3.1.1",
"rollup": "^4.9.1",
"tslib": "^2.6.2"
"@rollup/plugin-typescript": "^11.1.6",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"eslint": "8.57.0",
"prettier": "3.3.1",
"rollup": "^4.18.0",
"tslib": "^2.6.3"
},
"dependencies": {
"typescript": "^5.3.3",
"vanjs-core": "^1.2.7",
"yup": "^1.3.3"
"typescript": "^5.4.5",
"vanjs-core": "^1.5.0",
"yup": "^1.4.0"
},
"peerDependencies": {
"vanjs-core": "^1.2.7",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class Form<T extends Record<string, unknown>> {
field.touched.val = false;
field.error.val = "";

if (this.validationMode === "oninput") this.validateField(name);
// if (this.validationMode === "oninput") this.validateField(name);
}
} else {
for (const key in this.fields) {
Expand All @@ -151,7 +151,7 @@ export class Form<T extends Record<string, unknown>> {
field.touched.val = false;
field.error.val = "";

if (this.validationMode === "oninput") this.validateField(key);
// if (this.validationMode === "oninput") this.validateField(key);
}
}
}
Expand Down
Loading

0 comments on commit 562f73e

Please sign in to comment.