Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submitData gets thrown away if onValid submit handler is used #149

Open
melanieseltzer opened this issue Jan 10, 2025 · 0 comments
Open

Comments

@melanieseltzer
Copy link

melanieseltzer commented Jan 10, 2025

Hi folks 👋

I am using the onValid submit handler in the following way (with a fetcher):

submitHandlers: {
  onValid: (data) => {
    const dirtyValues = getDirtyFormValues(data, dirtyFields);
    const formData = createFormData(dirtyValues);
    fetcher.submit(formData, {
      method: "POST",
    });
  },
},

I noticed that when I do this, it now no longer passes through extra values from submitData to the server on form submission 🤔

Looks like the merged payload gets thrown away when onValid is taking over.

Is that intentional? Could they just be merged into the data passed into the valid handler here? Or do I have to manually pass them myself in createFormData now in onValid (not use submitData anymore).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant