42-px / effector-forms

106 stars 16 forks source link

missing form.resetDirty() ? #8

Closed rost-git closed 1 year ago

rost-git commented 3 years ago

Right now isDirty=true after setForm()

Use case: 1) Form initial values are empty string 2) After API request you get data and use form.setForm() 3) Then you want to enable Submit button only when something has changed. (disabled={isDirty == false})

We need form.resetDirty() or setForm() should reset all except values (witch I think is correct behaviour).

PS: Thank you for wonderful lib. Liked it a-lot:)

aanation commented 1 year ago

@rost-git

I solved this problem in a different way. I added the setInitialForm method that overrides the initial values. That way the isDirty flag becomes false

Please, use v.1.1.0