42-px / effector-forms

108 stars 16 forks source link

Field without rules array #4

Closed i1yas closed 1 year ago

i1yas commented 3 years ago

Is this intended behavior?

import { createForm } from "effector-forms";

const form = createForm({
  fields: {
    name: {
      init: ""
    },
    email: {
      init: "",
      rules: []
    }
  }
});

form.fields.name.$errors.watch((v) => console.log("name", v)); // name []
form.fields.email.$errors.watch((v) => console.log("email", v)); // email []

form.fields.name.addError({rule: "my-rule", errorText: "Test"}); // nothing
form.fields.email.addError({rule: "my-rule", errorText: "Test"}); // email [Object]

Field without rules ignores addErrors event

aanation commented 1 year ago

@i1yas

Fixed, use v1.1.0