vue-dynamic-forms icon indicating copy to clipboard operation
vue-dynamic-forms copied to clipboard

Setting a field to empty doesn't emit change event

Open OmgImAlexis opened this issue 4 years ago • 3 comments

Describe the bug When a user types into an input box it emits a "change" event. If the field is set to "" the change event isn't fired.

To Reproduce

  1. Create project with @next branch.
  2. Fill a field with text
  3. Empty field
  4. See the field is still showing the previous string

Expected behavior The field to be cleared and the change event to be fired.

Additional context The sandbox doesn't have this issue and I believe that's because it's still using the vue 2 version.

OmgImAlexis avatar Jul 09 '21 23:07 OmgImAlexis

https://github.com/asigloo/vue-dynamic-forms/blob/main/src/composables/useInputEvents.ts#L94

nkanetka avatar Oct 21 '21 18:10 nkanetka

The hasValue(curr) check needs to be removed.

OmgImAlexis avatar Oct 21 '21 19:10 OmgImAlexis

It looks like there are 3 places that need the check removed:

  • [ ] https://github.com/asigloo/vue-dynamic-forms/blob/main/src/composables/useInputEvents.ts#L94
  • [ ] https://github.com/asigloo/vue-dynamic-forms/blob/main/src/composables/useInputEvents.ts#L32
  • [ ] https://github.com/asigloo/vue-dynamic-forms/blob/main/src/composables/useDynamicForm.ts#L181

I'm curious if this is a desired change that could be implemented? I'm happy to implement it, however it looks like there are unit tests checking that this functionality "works" and I don't have the context on why it was implemented this way in the first place.

Maybe @alvarosaburido can comment?

nkanetka avatar Oct 21 '21 21:10 nkanetka