sveltejs / sveltejs/kit

Pass form data to remote form function enhance callback

Open Beginner friendly
#14,477 30 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

forms
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

It should be possible to mutate the form data in the remote form functions enhance callback like it is possible within the enhance action.

Describe the proposed solution

Pass a formData prop to the enhance callback function.
https://github.com/sveltejs/kit/blob/19211c15dcf70aaf3a07820abbee22bf7049dc1a/packages/kit/src/runtime/client/remote-functions/form.svelte.js#L100-L104 should be:

				await callback({
					form,
					data,
+					formData: form_data,
					submit: () => submit(form_data)
				});
Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/kit/src/runtime/client/remote-functions/form.svelte.js at the enhance callback around lines 100-104, and inspect how form_data is passed to the callback and submit function. Update the callback contract so formData is available for mutation, then verify that remote form enhance callbacks can access it while existing form and submit behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.