@vuehookform/core 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -624,7 +624,10 @@ function createValidation(ctx) {
624
624
  if (fieldPath) {
625
625
  valueHash = hashValue(get(ctx.formData, fieldPath));
626
626
  const cached = ctx.validationCache.get(fieldPath);
627
- if (cached && cached.hash === valueHash) return cached.isValid;
627
+ if (cached && cached.hash === valueHash) {
628
+ if (cached.isValid) ctx.errors.value = cancelError(fieldPath);
629
+ return cached.isValid;
630
+ }
628
631
  const analysis = analyzeSchemaPath(ctx.options.schema, fieldPath);
629
632
  if (analysis.canPartialValidate && analysis.subSchema) return validateFieldPartial(fieldPath, analysis.subSchema, valueHash, criteriaMode, generationAtStart);
630
633
  return validateFieldFull(fieldPath, valueHash, criteriaMode, generationAtStart);
@@ -1604,7 +1607,12 @@ function useController(options) {
1604
1607
  form.setValue(name, newValue);
1605
1608
  };
1606
1609
  const onBlur = () => {
1607
- form.trigger(name);
1610
+ const currentValue = form.getValues(name);
1611
+ form.setValue(name, currentValue, {
1612
+ shouldTouch: true,
1613
+ shouldValidate: true,
1614
+ shouldDirty: false
1615
+ });
1608
1616
  };
1609
1617
  const refCallback = (el) => {
1610
1618
  elementRef.value = el;
@@ -622,7 +622,10 @@ function createValidation(ctx) {
622
622
  if (fieldPath) {
623
623
  valueHash = hashValue(get(ctx.formData, fieldPath));
624
624
  const cached = ctx.validationCache.get(fieldPath);
625
- if (cached && cached.hash === valueHash) return cached.isValid;
625
+ if (cached && cached.hash === valueHash) {
626
+ if (cached.isValid) ctx.errors.value = cancelError(fieldPath);
627
+ return cached.isValid;
628
+ }
626
629
  const analysis = analyzeSchemaPath(ctx.options.schema, fieldPath);
627
630
  if (analysis.canPartialValidate && analysis.subSchema) return validateFieldPartial(fieldPath, analysis.subSchema, valueHash, criteriaMode, generationAtStart);
628
631
  return validateFieldFull(fieldPath, valueHash, criteriaMode, generationAtStart);
@@ -1602,7 +1605,12 @@ function useController(options) {
1602
1605
  form.setValue(name, newValue);
1603
1606
  };
1604
1607
  const onBlur = () => {
1605
- form.trigger(name);
1608
+ const currentValue = form.getValues(name);
1609
+ form.setValue(name, currentValue, {
1610
+ shouldTouch: true,
1611
+ shouldValidate: true,
1612
+ shouldDirty: false
1613
+ });
1606
1614
  };
1607
1615
  const refCallback = (el) => {
1608
1616
  elementRef.value = el;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuehookform/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "TypeScript-first form library for Vue 3, inspired by React Hook Form. Form-level state management with Zod validation.",
5
5
  "type": "module",
6
6
  "main": "./dist/vuehookform.cjs",