Skip to content

onSubmit Function Behaves InappropriateΒ #197

@tlherysr

Description

@tlherysr

Summary

If you try to update an array, onSubmit function confuses the parameter and replaces all the elements with the newest value.

Steps to reproduce

Initiate a form and use the onSubmit function to update an array like this:

let newMembers = [];

const { form, handleSubmit } = createForm({
      initialValues: {
        name: "",
        members: []
      },
      onSubmit: newUser => {
         newMembers.push(newUser)
      }
});

What is the current bug behavior?

onSubmit function uses the new parameter and replaces all the elements with the new one.

What is the expected correct behavior?

The function should add the element to the end of the array instead of updating all the elements

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions