sveltejs / sveltejs/kit

Remote functions form enhance documentation is confusing

Open
#15,099 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

The current example

 <form {...createPost.enhance(async ({ form, data, submit }) => {
	try {
		await submit();
		form.reset();

		showToast('Successfully published!');
	} catch (error) {
		showToast('Oh no! Something went wrong');
	}
})}>
	<!-- -->
</form>

gives the impression, given the preceding examples with validation, that a successful submit() implicitly means that the validation was successful.

The documentation would be better if it showed explicit handling of failed validation.

Reproduction

N/A

Logs
N/A
System Info
N/A
Severity

annoyance

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 with the linked Remote functions form-enhance example and compare it with the preceding validation examples. Update the documentation to show explicit handling of failed validation after submit(), and verify that the example no longer implies that a successful submission means validation succeeded.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.