eManPrague / frui.ts

Pragmatic MVVM frontend framework
MIT License
14 stars 5 forks source link

Error with repeated validation by ManualValidator and showup erorrs at control #27

Closed kopecmi8 closed 3 years ago

kopecmi8 commented 3 years ago

Frui.ts "0.15.0"

Code sample

View example

<Form onSubmit={preventDefault(vm.onSearch)}>
  <Input target={vm} property="searchLicensePlate" />
  <Button type="submit">Search</Button>
</Form >

VM example

class Example extends ScreenBase {
  @observable searchLicensePlate: string; 

  constructor() {
    super();
    attachManualValidator(this);
  }

  @bound
  onSearch() {
     if (!this.searchLicensePlate) {
        addError(this, "searchLicensePlate", "Error message");
     }

    if (validate(this)) {
       // do something
    }
  }
}

Steps to error

  1. Validate valid data with manualValidator
  2. Change input data to invalid and revalidate data.

Now error occurred. Inside ManualValidator everything is okay but view does not react on changes at errorsObject and error message is not shown till input value is changed.

gius commented 3 years ago

Thank you for reporting the issue. Could you please check if v0.16.0-beta.10 fixes the issue for you?

kopecmi8 commented 3 years ago

It helps. Thanks a lot