Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: logaretm/vee-validate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.12.3
Choose a base ref
...
head repository: logaretm/vee-validate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.12.4
Choose a head ref
  • 3 commits
  • 23 files changed
  • 3 contributors

Commits on Dec 19, 2023

  1. fix: unset paths (#4607)

    not removing paths which were re-created between unset schedule and dispatch
    zaalbarxx authored Dec 19, 2023
    Copy the full SHA
    61e75a3 View commit details

Commits on Dec 27, 2023

  1. Copy the full SHA
    2a09a58 View commit details
  2. chore(release): publish

    logaretm committed Dec 27, 2023
    Copy the full SHA
    39acc59 View commit details
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 4.12.4

### Patch Changes

- 2a09a58: "fix: check if both source and target objects are POJOs"

## 4.12.3

### Patch Changes
8 changes: 4 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@
"@stackblitz/sdk": "^1.9.0",
"@types/fs-extra": "^11.0.4",
"@types/lodash-es": "^4.17.12",
"@vee-validate/valibot": "^4.12.3",
"@vee-validate/yup": "^4.12.3",
"@vee-validate/zod": "^4.12.3",
"@vee-validate/valibot": "^4.12.4",
"@vee-validate/yup": "^4.12.4",
"@vee-validate/zod": "^4.12.4",
"@vue/repl": "^3.0.0",
"@vueuse/core": "^10.7.0",
"astro": "^3.6.4",
@@ -32,7 +32,7 @@
"tailwindcss": "^3.3.6",
"unist-util-visit": "^5.0.0",
"valibot": "^0.24.1",
"vee-validate": "^4.12.3",
"vee-validate": "^4.12.4",
"vue": "^3.3.11",
"yup": "^1.3.2",
"zod": "^3.22.4"
2 changes: 2 additions & 0 deletions packages/i18n/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change Log

## 4.12.4

## 4.12.3

## 4.12.2
2 changes: 1 addition & 1 deletion packages/i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vee-validate/i18n",
"version": "4.12.3",
"version": "4.12.4",
"description": "Localization module for VeeValidate",
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
"homepage": "https://vee-validate.logaretm.com/v4/guide/i18n",
7 changes: 7 additions & 0 deletions packages/joi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 4.12.4

### Patch Changes

- Updated dependencies [2a09a58]
- vee-validate@4.12.4

## 4.12.3

### Patch Changes
4 changes: 2 additions & 2 deletions packages/joi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vee-validate/joi",
"version": "4.12.3",
"version": "4.12.4",
"description": "vee-validate integration with joi schema validation",
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
"license": "MIT",
@@ -30,6 +30,6 @@
"dependencies": {
"joi": "17.11.0",
"type-fest": "^4.8.3",
"vee-validate": "4.12.3"
"vee-validate": "4.12.4"
}
}
7 changes: 7 additions & 0 deletions packages/nuxt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @vee-validate/nuxt

## 4.12.4

### Patch Changes

- Updated dependencies [2a09a58]
- vee-validate@4.12.4

## 4.12.3

### Patch Changes
4 changes: 2 additions & 2 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vee-validate/nuxt",
"version": "4.12.3",
"version": "4.12.4",
"description": "Official vee-validate nuxt module",
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
"license": "MIT",
@@ -39,7 +39,7 @@
"dependencies": {
"@nuxt/kit": "^3.8.2",
"local-pkg": "^0.5.0",
"vee-validate": "4.12.3"
"vee-validate": "4.12.4"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.2.0",
7 changes: 7 additions & 0 deletions packages/rules/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 4.12.4

### Patch Changes

- Updated dependencies [2a09a58]
- vee-validate@4.12.4

## 4.12.3

### Patch Changes
4 changes: 2 additions & 2 deletions packages/rules/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vee-validate/rules",
"version": "4.12.3",
"version": "4.12.4",
"description": "Form Validation for Vue.js",
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
"license": "MIT",
@@ -28,6 +28,6 @@
"dist/*.d.ts"
],
"dependencies": {
"vee-validate": "4.12.3"
"vee-validate": "4.12.4"
}
}
2 changes: 1 addition & 1 deletion packages/shared/utils.ts
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ export function isPlainObject(value: any) {

export function merge(target: any, source: any) {
Object.keys(source).forEach(key => {
if (isPlainObject(source[key])) {
if (isPlainObject(source[key]) && isPlainObject(target[key])) {
if (!target[key]) {
target[key] = {};
}
7 changes: 7 additions & 0 deletions packages/valibot/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @vee-validate/valibot

## 4.12.4

### Patch Changes

- Updated dependencies [2a09a58]
- vee-validate@4.12.4

## 4.12.3

### Patch Changes
4 changes: 2 additions & 2 deletions packages/valibot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vee-validate/valibot",
"version": "4.12.3",
"version": "4.12.4",
"description": "vee-validate integration with valibot schema validation",
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
"license": "MIT",
@@ -30,6 +30,6 @@
"dependencies": {
"type-fest": "^4.8.3",
"valibot": "^0.24.1",
"vee-validate": "4.12.3"
"vee-validate": "4.12.4"
}
}
6 changes: 6 additions & 0 deletions packages/vee-validate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 4.12.4

### Patch Changes

- 2a09a58: "fix: check if both source and target objects are POJOs"

## 4.12.3

### Patch Changes
2 changes: 1 addition & 1 deletion packages/vee-validate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vee-validate",
"version": "4.12.3",
"version": "4.12.4",
"description": "Painless forms for Vue.js",
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
"license": "MIT",
6 changes: 6 additions & 0 deletions packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
@@ -289,6 +289,12 @@ export function useForm<

const currentValue = computed(() => getFromPath(formValues, toValue(path)));
const pathValue = toValue(path);

const unsetBatchIndex = UNSET_BATCH.findIndex(_path => _path === pathValue);
if (unsetBatchIndex !== -1) {
UNSET_BATCH.splice(unsetBatchIndex, 1);
}

const isRequired = computed(() => {
if (isTypedSchema(schema)) {
return (schema as TypedSchema).describe?.(toValue(path)).required ?? false;
51 changes: 51 additions & 0 deletions packages/vee-validate/tests/useField.spec.ts
Original file line number Diff line number Diff line change
@@ -1009,4 +1009,55 @@ describe('useField()', () => {
await flushPromises();
expect(field.errors.value).toHaveLength(0);
});

// #4603
test('should not remove field value if field with same path was created between scheduling and execution of previous field unset operation', async () => {
vi.useFakeTimers();
let form!: FormContext;
mountWithHoc({
setup() {
form = useForm();
const toggle = ref(false);
const value = ref('');

onMounted(async () => {
await new Promise(resolve => {
setTimeout(() => resolve(null), 1000);
});

toggle.value = true;
value.value = 'test';
});
return { form, toggle, value };
},
template: `
<template v-if="!toggle">
<CustomField name="field" :model-value="value" />
</template>
<template v-if="toggle">
<CustomField name="field" :model-value="value" />
</template>
`,
components: {
CustomField: {
props: {
name: String,
modelValue: String,
},
setup(props: any) {
useField(props.name, undefined, {
initialValue: props.modelValue,
});
},
template: `<input type="text" :value="modelValue" :name="name" />`,
},
},
});

await flushPromises();
vi.advanceTimersByTime(1000);
await flushPromises();

expect(form.values.field).toEqual('test');
});
});
27 changes: 27 additions & 0 deletions packages/vee-validate/tests/useForm.spec.ts
Original file line number Diff line number Diff line change
@@ -1398,4 +1398,31 @@ describe('useForm()', () => {
await flushPromises();
await expect(form.errors.value.fname).toBe(undefined);
});

test('checks if both source and target are POJO before setting properties', async () => {
let form!: FormContext<{ file: { name: string; size: number } }>;
const f1 = new File([''], 'f1.text');
const f2 = { name: 'f2.text', size: 123 };

mountWithHoc({
setup() {
form = useForm({
initialValues: { file: f1 },
});

form.defineField('file');

return {};
},
template: `
<div></div>
`,
});

await flushPromises();
expect(form.values.file).toBeInstanceOf(File);
expect(form.values.file).toBe(f1);
form.setValues({ file: f2 });
expect(form.values.file).toEqual(f2);
});
});
7 changes: 7 additions & 0 deletions packages/yup/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 4.12.4

### Patch Changes

- Updated dependencies [2a09a58]
- vee-validate@4.12.4

## 4.12.3

### Patch Changes
4 changes: 2 additions & 2 deletions packages/yup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vee-validate/yup",
"version": "4.12.3",
"version": "4.12.4",
"description": "vee-validate integration with yup schema validation",
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
"license": "MIT",
@@ -29,7 +29,7 @@
],
"dependencies": {
"type-fest": "^4.8.3",
"vee-validate": "4.12.3",
"vee-validate": "4.12.4",
"yup": "^1.3.2"
},
"publishConfig": {
7 changes: 7 additions & 0 deletions packages/zod/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 4.12.4

### Patch Changes

- Updated dependencies [2a09a58]
- vee-validate@4.12.4

## 4.12.3

### Patch Changes
4 changes: 2 additions & 2 deletions packages/zod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vee-validate/zod",
"version": "4.12.3",
"version": "4.12.4",
"description": "vee-validate integration with zod schema validation",
"author": "Abdelrahman Awad <logaretm1@gmail.com>",
"license": "MIT",
@@ -29,7 +29,7 @@
],
"dependencies": {
"type-fest": "^4.8.3",
"vee-validate": "4.12.3",
"vee-validate": "4.12.4",
"zod": "^3.22.4"
}
}
Loading